combinat::graphPaths – paths in a directed graph with labelled arrows

combinat::graphPaths(graph) provides methods for counting, listing, and manipulating paths in the directed graph graph with no circuits.

→ Examples

Details:

Entries

"domtype"

The MuPAD domain used to represent paths: DOM_LIST

isA – tests if an object is a path in the given graph

combinat::graphPaths::isA(any type p)

Returns TRUE if p is a path in the ambient graph and FALSE otherwise.

count – number of paths

combinat::graphPaths::count(<constraints>)

Returns the number of paths in the ambient graph, one can specify the target and/or the source.

source – source of a path

combinat::graphPaths::source(path p)

Returns the source of the path p.

target – target of a path

combinat::graphPaths::target(path p)

Returns the target of the path p.

length – length of a path

combinat::graphPaths::length(path p)

Returns the length of the path p.

_concat – concatenation of two paths

combinat::graphPaths::_concat(path v, path u)

Returns the concatenation v.u of the paths v and u when it is defined and FAIL otherwise.

edgesLeaving – arrows starting from a vertex

combinat::graphPaths::edgesLeaving(vertex x)

Returns the list of the arrows with source x.

edgesArrivingAt – arrows ending at a vertex

combinat::graphPaths::edgesArrivingAt(vertex x)

Returns the list of the arrows with target x.

adjacencyMatrix – adjacency matrix of the graph

combinat::graphPaths::adjacencyMatrix(directed graph graph)

Returns the adjacency matrix of the graph graph: this is a square matrix of size graph[1] x graph[1], whose value at row i and column j is equal to the number of arrows with source i and target j.

countMatrix – matrix counting the paths in the graph

combinat::graphPaths::countMatrix()

Returns a square matrix of size graph[1] x graph[1], whose value at row i and column j is equal to the number of paths with source i and target j.

maxLength – the maximal length of the paths in the ambient graph

combinat::graphPaths::maxLength()

Returns the maximal length of the paths in the graph.

Example 1:

Consider the following graph:

    graph := [4,table(a=[1,2], b=[1,2], c=[2,3], d=[3,4], e=[2,4])]:

    alias(S = combinat::graphPaths(graph)):

 

    S::isA([1, 1])

math

    S::isA([2, a, 1])

math

    S::isA([4, d, c, a, 1])

math

    S::isA([2, b, a, 1])

math

    S::source([1, 1])

math

    S::source([4, e, b, 1])

math

    S::target([1, 1])

math

    S::target([4, e, b, 1])

math

S::length([1, 1])

math

S::length([2, a, 1])

math

S::length([4, d, c, a, 1])

math

    S::list()

math

    S::list(Source = 1, Target = 4)

math

    S::_concat([2, a, 1], [1, 1])

math

    S::_concat([4, e, a, 1], [1, 1])

math

    S::_concat([2, a, 1], [2, b, 1])

math

    S::edgesLeaving(2)

math

    S::edgesArrivingAt(2)

math

    S::adjacencyMatrix()

math

    S::countMatrix()

math

S::maxLength()

math

Changes in MuPAD 3.2

New Function.