PHP 트레잇 Gliph\Graph\AdjacencyList

Adjacency lists store vertices directly, and edges relative to the vertices they connect. That means there is no overall list of edges in the graph; only a list of the graph's vertices. In this implementation, that list is keyed by vertex, with the value being a list of all the vertices to which that vertex is adjacent - hence, "adjacency list." Consequently, this structure offers highly efficient access to vertices, but less efficient access to edges. In an undirected graph, the edges are stored in both vertices' adjacency lists. In a directed graph, only the out-edges are stored in each vertex's adjacency list. This makes accessing in-edge information in a directed graph highly inefficient.
파일 보기 프로젝트 열기: sdboyer/gliph

보호된 프로퍼티들

프로퍼티 타입 설명
$size integer We keep track because calculating it on demand is expensive.
$vertices SplObjectStorage Contains the adjacency list of vertices.
$walking SplObjectStorage Bookkeeper for nested iteration.

공개 메소드들

메소드 설명
__construct ( )
ensureVertex ( $vertex )
hasVertex ( $vertex )
order ( )
size ( )
vertices ( )

보호된 메소드들

메소드 설명
getTraversableSplos ( SplObjectStorage $splos ) : SplObjectStorage Helper function to ensure SPLOS traversal pointer is not overridden.

메소드 상세

__construct() 공개 메소드

public __construct ( )

ensureVertex() 공개 메소드

public ensureVertex ( $vertex )

getTraversableSplos() 보호된 메소드

This would otherwise occur if nested calls are made that traverse the same SPLOS. This keeps track of which SPLOSes are currently being traversed, and if it's in use, it returns a clone. It is incumbent on the calling code to release the semaphore directly by calling $this->walking->detach($splos) when the traversal in question is complete. (This is very important!)
protected getTraversableSplos ( SplObjectStorage $splos ) : SplObjectStorage
$splos SplObjectStorage The SPLOS to traverse.
리턴 SplObjectStorage A SPLOS that is safe for traversal; may or may not be a clone of the original.

hasVertex() 공개 메소드

public hasVertex ( $vertex )

order() 공개 메소드

public order ( )

size() 공개 메소드

public size ( )

vertices() 공개 메소드

public vertices ( )

프로퍼티 상세

$size 보호되어 있는 프로퍼티

We keep track because calculating it on demand is expensive.
protected int $size
리턴 integer

$vertices 보호되어 있는 프로퍼티

Contains the adjacency list of vertices.
protected SplObjectStorage $vertices
리턴 SplObjectStorage

$walking 보호되어 있는 프로퍼티

Bookkeeper for nested iteration.
protected SplObjectStorage $walking
리턴 SplObjectStorage