Skip to content

Commit d872510

Browse files
committed
Add GraphProperty::isNull() and documentation
1 parent eef93ef commit d872510

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Property/GraphProperty.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,31 @@ class GraphProperty extends BaseGraph
1414
/**
1515
* checks whether this graph has no edges
1616
*
17+
* Also known as empty Graph. An empty Graph contains no edges, but can
18+
* possibly contain any number of isolated vertices.
19+
*
1720
* @return boolean
1821
*/
1922
public function isEdgeless()
2023
{
2124
return $this->graph->getEdges()->isEmpty();
2225
}
2326

27+
/**
28+
* checks whether this graph is a null graph (no vertex - and thus no edges)
29+
*
30+
* Each Edge is incident to two Vertices, or in case of an loop Edge,
31+
* incident to the same Vertex twice. As such an Edge can not exist when
32+
* no Vertices exist. So if we check we have no Vertices, we can also be
33+
* sure that no Edges exist either.
34+
*
35+
* @return boolean
36+
*/
37+
public function isNull()
38+
{
39+
return $this->graph->getVertices()->isEmpty();
40+
}
41+
2442
/**
2543
* checks whether this graph is trivial (one vertex and no edges)
2644
*

0 commit comments

Comments
 (0)