Inherits from NSObject
Declared in PCGDirectedGraph.h
PCGDirectedGraph.m

Overview

The PCGDirectedGraph class is an implementation of a weighted directed graph (or weighted digraph, or network).

Definition

See http://en.wikipedia.org/wiki/Directed_graph for directed graph theory.

Thread

This class is not thread safe.

Class Methods

directedGraph

Creates, initialises and returns an empty PCGDirectedGraph object with default capacity.

+ (instancetype)directedGraph

Return Value

an empty PCGDirectedGraph

Declared In

PCGDirectedGraph.h

directedGraphWithCapacity:

Creates, initialises and returns an empty PCGDirectedGraph object with the specified capacity.

+ (instancetype)directedGraphWithCapacity:(NSUInteger)capacity

Parameters

capacity

the initial vertices container capacity

Return Value

an empty PCGDirectedGraph

Declared In

PCGDirectedGraph.h

Instance Methods

addEdgeFromVertex:toVertex:

Add or replace an edge from source to target vertices, with weight of 1, adding source and target vertices if they do not exist in this graph.

- (void)addEdgeFromVertex:(PCGVertex)source toVertex:(PCGVertex)target

Parameters

source

The source vertex

target

The target vertex

Declared In

PCGDirectedGraph.h

addEdgeFromVertex:toVertex:withWeight:

Add or replace an edge from source to target vertices, with the specified weight, adding source and target vertices if they do not exist in this graph.

- (void)addEdgeFromVertex:(PCGVertex)source toVertex:(PCGVertex)target withWeight:(NSUInteger)weight

Parameters

source

The source vertex

target

The target vertex

weight

The weight of the edge

Declared In

PCGDirectedGraph.h

addEdgesBetweenVertex:andVertex:

Add or replace an edge from source to target vertices and then from target to source, both edges with weight of 1, adding source and target vertices if they do not exist in this graph.

- (void)addEdgesBetweenVertex:(PCGVertex)source andVertex:(PCGVertex)target

Parameters

source

The source vertex

target

The target vertex

Declared In

PCGDirectedGraph.h

addEdgesBetweenVertex:andVertex:withWeight:

Add or replace an edge from source to target vertices and then from target to source, both edges with the specified weight, adding source and target vertices if they do not exist in this graph.

- (void)addEdgesBetweenVertex:(PCGVertex)source andVertex:(PCGVertex)target withWeight:(NSUInteger)weight

Parameters

source

The source vertex

target

The target vertex

weight

The weight of the edges

Declared In

PCGDirectedGraph.h

addVertex:

Add vertex source if it does not exist in this graph.

- (void)addVertex:(PCGVertex)source

Parameters

source

The source vertex

Declared In

PCGDirectedGraph.h

init

Initialises and returns an empty PCGDirectedGraph object with default capacity.

- (instancetype)init

Return Value

an empty PCGDirectedGraph

Declared In

PCGDirectedGraph.h

initWithCapacity:

Initialises and returns an empty PCGDirectedGraph object with the specified capacity.

- (instancetype)initWithCapacity:(NSUInteger)capacity

Parameters

capacity

the initial vertices container capacity

Return Value

an empty PCGDirectedGraph

Declared In

PCGDirectedGraph.h

removeEdgeFromVertex:toVertex:

Remove edge if it exists in this graph from source to target vertices.

- (void)removeEdgeFromVertex:(PCGVertex)source toVertex:(PCGVertex)target

Parameters

source

The source vertex

target

The target vertex

Declared In

PCGDirectedGraph.h

removeEdgesBetweenVertex:andVertex:

Remove edges if they exists in this graph between source and target vertices.

- (void)removeEdgesBetweenVertex:(PCGVertex)source andVertex:(PCGVertex)target

Parameters

source

The source vertex

target

The target vertex

Declared In

PCGDirectedGraph.h

removeEdgesFromVertex:

Remove edges if they exists in this graph going from source vertex to any vertices.

- (void)removeEdgesFromVertex:(PCGVertex)source

Parameters

source

The source vertex

Declared In

PCGDirectedGraph.h

removeEdgesToVertex:

Remove edges if they exists in this graph going from any vertices to target vertex.

- (void)removeEdgesToVertex:(PCGVertex)target

Parameters

target

The target vertex

Declared In

PCGDirectedGraph.h

removeVertex:

Remove vertex source if it exists in this graph, removing also all edges going from and to it.

- (void)removeVertex:(PCGVertex)source

Parameters

source

The source vertex

Declared In

PCGDirectedGraph.h