# \GraphDS\GraphDirectedGraph

Class defining a directed graph object.

## Summary

Methods
Properties
Constants
__construct()
getVertexCount()
getEdgeCount()
addVertex()
removeVertex()
edge()
addEdge()
removeEdge()
getTranspose()
$vertices
$edges
$directed
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

File
  Graph/DirectedGraph.php
Package
  Default
Class hierarchy
  \GraphDS\Graph\Graph
  \GraphDS\Graph\DirectedGraph

## Tags

None found

## Properties

### $vertices

    $vertices : array

An array holding all vertices of the graph.

#### Type

array

#

Inherited from
  \GraphDS\Graph\Graph

## Tags

None found

### $edges

    $edges : array

An array holding all edges of the graph.

#### Type

array

#

Inherited from
  \GraphDS\Graph\Graph

## Tags

None found

### $directed

    $directed : boolean

Defines whether the graph is directed or not.

#### Type

boolean

#

Inherited from
  \GraphDS\Graph\Graph

## Tags

None found

## Methods

### __construct()

    __construct()

Constructor for DirectedGraph object.

#

Inherited from
  \GraphDS\Graph\DirectedGraph

## Tags

None found

### getVertexCount()

    getVertexCount() : integer

Returns the number of vertices in the graph.

#### Returns

integer —

Number of vertices in the graph

#

Inherited from
  \GraphDS\Graph\Graph

## Tags

None found

### getEdgeCount()

    getEdgeCount() : integer

Returns the number of edges in the graph.

#### Returns

integer —

Number of edges in the graph

#

Inherited from
  \GraphDS\Graph\Graph

## Tags

None found

### addVertex()

    addVertex(string  $vertex)

Adds a directed vertex to the graph.

#### Parameters

string | $vertex | ID of the vertex

#

Inherited from
  \GraphDS\Graph\DirectedGraph

## Tags

None found

### removeVertex()

    removeVertex(string  $vertex)

Removes a directed vertex from the graph.

#### Parameters

string | $vertex | ID of the vertex

#### Throws

\InvalidArgumentException

#

Inherited from
  \GraphDS\Graph\DirectedGraph

## Tags

None found

### edge()

    edge(string  $vertex1, string  $vertex2) : object

Returns an edge object in the graph from $vertex1 to $vertex2.

#### Parameters

string | $vertex1 | ID of first vertex
string | $vertex2 | ID of second vertex

#### Throws

\InvalidArgumentException

#### Returns

object —

Instance of DirectedEdge from $vertex1 to $vertex2

#

Inherited from
  \GraphDS\Graph\DirectedGraph

## Tags

None found

### addEdge()

    addEdge(string  $vertex1, string  $vertex2, float  $value = null)

Adds a directed edge between two directed vertices ($vertex1 to $vertex2).

#### Parameters

string | $vertex1 | ID of first vertex
string | $vertex2 | ID of second vertex
float | $value | The value/weight the edge should hold

#### Throws

\InvalidArgumentException

#

Inherited from
  \GraphDS\Graph\DirectedGraph

## Tags

None found

### removeEdge()

    removeEdge(string  $vertex1, string  $vertex2)

Removes a directed edge between two directed vertices ($vertex1 to $vertex2).

#### Parameters

string | $vertex1 | ID of first vertex
string | $vertex2 | ID of second vertex

#### Throws

\InvalidArgumentException

#

Inherited from
  \GraphDS\Graph\DirectedGraph

## Tags

None found

### getTranspose()

    getTranspose() : \GraphDS\Graph\DirectedGraph

Transposes the graph, reversing each directed edge.

#### Throws

\InvalidArgumentException

#### Returns

\GraphDS\Graph\DirectedGraph —

The transposed graph

#

Inherited from
  \GraphDS\Graph\DirectedGraph

## Tags

None found

### DirectedGraph.php