Skip to content

Instantly share code, notes, and snippets.

@ircmaxell
Created August 1, 2014 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ircmaxell/f1e67efce367502d4ab1 to your computer and use it in GitHub Desktop.
Save ircmaxell/f1e67efce367502d4ab1 to your computer and use it in GitHub Desktop.
<?php
namespace Gliph\Graph;
/**
* Interface for bidirectional directed graph datastructures.
*/
interface BiDirectedGraph extends DirectedGraph {
/**
* Loops over each vertex that is inbound to the given vertex.
*
* The generator yields an edge as key and the adjacent vertex as value. The
* form by which the edge is represented may vary from one graph
* implementation to another, but the representation should be the same as
* produced by the graph's eachEdge() implementation.
*
* @see Graph::eachEdge()
*
* @param object $vertex
* The vertex whose in-edges should be visited.
*
* @return \Generator
* A generator that yields the edge as key and adjacent vertex as value.
*
* @throws NonexistentVertexException
* Thrown if the vertex provided in the first parameter is not present in
* the graph.
*/
public function eachInbound($vertex);
/**
* Loops over each vertex that is outbound from the given vertex.
*
* The generator yields an edge as key and the adjacent vertex as value. The
* form by which the edge is represented may vary from one graph
* implementation to another, but the representation should be the same as
* produced by the graph's eachEdge() implementation.
*
* @see Graph::eachEdge()
*
* @param object $vertex
* The vertex whose out-edges should be visited.
*
* @return \Generator
* A generator that yields the edge as key and adjacent vertex as value.
*
* @throws NonexistentVertexException
* Thrown if the vertex provided in the first parameter is not present in
* the graph.
*/
public function eachOutbound($vertex);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment