-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from clue/move-algo-property
Move misc Graph/Walk property algorithms
- Loading branch information
Showing
7 changed files
with
648 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Fhaculty\Graph\Algorithm\Property; | ||
|
||
use Fhaculty\Graph\Algorithm\BaseGraph; | ||
|
||
/** | ||
* Simple algorithms for working with Graph properties | ||
* | ||
* @link https://en.wikipedia.org/wiki/Graph_property | ||
*/ | ||
class GraphProperty extends BaseGraph | ||
{ | ||
/** | ||
* checks whether this graph has no edges | ||
* | ||
* @return boolean | ||
*/ | ||
public function isEdgeless() | ||
{ | ||
return !$this->graph->getEdges(); | ||
} | ||
|
||
/** | ||
* checks whether this graph is trivial (one vertex and no edges) | ||
* | ||
* @return boolean | ||
*/ | ||
public function isTrivial() | ||
{ | ||
return (!$this->graph->getEdges() && $this->graph->getNumberOfVertices() === 1); | ||
} | ||
} |
Oops, something went wrong.