Represents a component of this
graph by a lazy implementation.
Controls the properties of consecutive graph traversals with no specific root.
Represents a cycle in this graph listing the nodes and connecting edges on it with the following syntax:
Type alias for entries in degree maps returned by degreeSeqMap
.
Type alias for entries in degree maps returned by degreeSeqMap
.
Decreasing ordering of nodes with respect to their degree.
Base trait for graph Ordering
s.
Template for extended node visitors.
Properties and methods for creating modified properties in a fluent-interface manner.
Controls the properties of inner-edge graph traversals.
Controls the properties of inner-element graph traversals.
Controls the properties of inner-node down-up graph traversals.
Controls the properties of inner-node graph traversals.
The empty ElemOrdering.
Ordering for the path dependent type NodeT.
Controls the properties of outer-edge graph traversals.
Controls the properties of outer-element graph traversals.
Controls the properties of outer-node down-up graph traversals.
Controls the properties of outer-node graph traversals.
Represents a path in this graph where
Properties controlling traversals.
Controls the properties of consecutive graph traversals starting at a root node.
The root
-related methods Traverser will inherit.
Represents a walk in this graph where
Abstract class for functional traversals.
Creates a new supergraph with an additional node, unless the node passed is already present.
Creates a new supergraph with an additional node, unless the node passed is already present.
the node to be added
the new supergraph containing all nodes and edges of this graph and node
additionally.
Creates a new supergraph with an additional edge, unless the edge passed is already present.
Creates a new supergraph with an additional edge, unless the edge passed is already present.
the edge to be added
the new supergraph containing all nodes and edges of this
graph plus edge
.
Creates a new subgraph consisting of all nodes and edges of this graph except node
and those edges which node
is incident with.
Creates a new subgraph consisting of all nodes and edges of this graph except node
and those edges which node
is incident with.
the node to be removed.
the new subgraph of this graph after the "ripple" deletion of node
.
Creates a new subgraph consisting of all nodes and edges of this graph except edge
and those nodes which are incident with edge
and would become edge-less after deletion.
Creates a new subgraph consisting of all nodes and edges of this graph except edge
and those nodes which are incident with edge
and would become edge-less after deletion.
the edge to be removed.
a new subgraph of this graph after the "ripple" deletion of edge
from
this graph.
Creates a new subgraph consisting of all nodes and edges of this graph but edge
.
Creates a new subgraph consisting of all nodes and edges of this graph but edge
.
The node set remains unchanged.
the edge to be removed.
a new subgraph of this graph that contains all nodes and edges of this graph
except of edge
.
Creates a new subgraph consisting of all nodes and edges of this graph but node
which is conditionally removed from this graph.
Creates a new subgraph consisting of all nodes and edges of this graph but node
which is conditionally removed from this graph. The removal only succeeds if the node
is not incident with any edges or it is only incident with hooks.
the node to be gently removed.
the new subgraph of this graph after the "gentle" deletion of node
.
If node
could not be deleted, the new graph is a copy of this graph.
Creates a ComponentTraverser responsible for invoking graph traversal methods that cover all components of this possibly disconnected graph.
Creates a ComponentTraverser responsible for invoking graph traversal methods that cover all components of this possibly disconnected graph.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
The edge set of this Graph
commonly referred to as E(G).
The edge set of this Graph
commonly referred to as E(G).
Set of all contained edges.
The companion object of This
.
The companion object of This
.
Creates a InnerEdgeTraverser based on scala.collection.Traversable[EdgeT]
.
Creates a InnerEdgeTraverser based on scala.collection.Traversable[EdgeT]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
Creates a InnerElemTraverser based on scala.collection.Traversable[InnerElem]
.
Creates a InnerElemTraverser based on scala.collection.Traversable[InnerElem]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
Creates a InnerNodeDownUpTraverser based on scala.collection.Traversable[(Boolean, NodeT)]
where the Boolean
parameter is true
if the traversal takes place
in downward and false
if it takes place in upward direction.
Creates a InnerNodeDownUpTraverser based on scala.collection.Traversable[(Boolean, NodeT)]
where the Boolean
parameter is true
if the traversal takes place
in downward and false
if it takes place in upward direction.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals. A kind
different from DepthFirst
will be ignored.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
Creates a InnerNodeTraverser based on scala.collection.Traversable[NodeT]
.
Creates a InnerNodeTraverser based on scala.collection.Traversable[NodeT]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
The node (vertex) set of this Graph
commonly referred to as V(G).
The node (vertex) set of this Graph
commonly referred to as V(G).
Set of all contained nodes.
Creates a OuterEdgeTraverser based on scala.collection.Traversable[E[N]]
.
Creates a OuterEdgeTraverser based on scala.collection.Traversable[E[N]]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
Creates a OuterElemTraverser based on scala.collection.Traversable[OuterElem]
.
Creates a OuterElemTraverser based on scala.collection.Traversable[OuterElem]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
Creates a OuterNodeDownUpTraverser based on scala.collection.Traversable[(Boolean, N)]
where the Boolean
parameter is true
if the traversal takes place
in downward and false
if it takes place in upward direction.
Creates a OuterNodeDownUpTraverser based on scala.collection.Traversable[(Boolean, N)]
where the Boolean
parameter is true
if the traversal takes place
in downward and false
if it takes place in upward direction.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals. A kind
different from DepthFirst
will be ignored.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
Creates a OuterNodeTraverser based on scala.collection.Traversable[N]
.
Creates a OuterNodeTraverser based on scala.collection.Traversable[N]
.
The node where subsequent graph traversals start.
The properties controlling subsequent traversals.
Restricts subsequent graph traversals to visit only nodes holding this predicate.
Restricts subsequent graph traversals to walk only along edges that hold this predicate.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
Creates a Traversal
instance allowing subsequent traversals with
constant filters and visitors.
Creates a Traversal
instance allowing subsequent traversals with
constant filters and visitors.
Determines which connected nodes the traversal has to follow.
The default value is Successors
.
Predicate to filter the nodes to be visited during traversal.
The default value is anyNode
, that is no filtering.
A return of true
signals that the traversal is to be canceled.
Predicate to filter the edges to be visited during traversal.
The default value is anyEdge
meaning that no filtering takes place.
Function to be called on visiting a node for the first time
during a traversal. It can mutate the node or carry out any other side effect.
The default value is the empty function noNodeAction
. Alternatively, an instance of ExtendedNodeVisitor
may be passed to obtain additional state information such as the current
depth. The concrete type of the last argument, the informer
depends on the underlying implementation so you need to match against it. Concerning this method please match against
scalax.collection.GraphTraversalImpl.DfsInformer or
scalax.collection.GraphTraversalImpl.BfsInformer depending on the
breadthFirst
argument.
Function to be called on visiting an edge.
It can mutate the node or carry out any other side effect.
The default value is the empty function noEdgeAction
.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
(Since version 1.8.0) use one of Traverser factory methods instead.
Creates a new supergraph with an additional node or edge, unless the node or edge passed is already present.
Creates a new supergraph with an additional node or edge, unless the node or edge passed is already present.
This method purely wraps +(node: N)
respectively +(edge: E[N])
granting the same behavior.
the wrapped node or edge to be added; ; if elem
is of type N,
the wrapped object is added to the node set otherwise to the edge set.
a new supergraph containing all nodes and edges of this graph
plus elem
.
Creates a new subgraph consisting of all nodes and edges of this graph except elem
.
Creates a new subgraph consisting of all nodes and edges of this graph except elem
.
If elem
is of type N, this method maps to -(node: N)
. Otherwise the edge is deleted
leaving the node set unchanged.
node or edge to be removed.
the new subgraph of this graph after the "ripple" deletion of the passed node or the simple deletion of the passed edge.
Creates a new subgraph consisting of all nodes and edges of this graph except elem
.
Creates a new subgraph consisting of all nodes and edges of this graph except elem
.
If elem
is of type N, this method maps to -(node: N)
. Otherwise the edge is deleted
along with those incident nodes which would become edge-less after deletion.
node or edge to be removed.
a new subgraph of this graph after the "ripple" deletion of the passed node or edge.
Creates a new subgraph consisting of all nodes and edges of this graph but the elements
of coll
which will be unconditionally removed.
Creates a new subgraph consisting of all nodes and edges of this graph but the elements
of coll
which will be unconditionally removed. This operation differs from --
in that edges are deleted along with those incident nodes which would become isolated
after deletion.
the new subgraph containing all nodes and edges of this graph
after the "ripple" deletion of nodes and the simple deletion of edges in coll
.
Ordering for the path dependent type EdgeT.
Decreasing ordering of integers.
Default edge filter letting path all edges (non-filter).
Default edge filter letting path all edges (non-filter).
Default node filter letting path all nodes (non-filter).
Default node filter letting path all nodes (non-filter).
Sorts all nodes of this graph by ordNode
followed by all edges sorted by ordEdge
and concatinates their string representation nodeSeparator
and edgeSeparator
respectively.
Sorts all nodes of this graph by ordNode
followed by all edges sorted by ordEdge
and concatinates their string representation nodeSeparator
and edgeSeparator
respectively.
to separate nodes by.
to separate edges by.
to separate nodes from edges by.
whether the node and edge set should be prefixed.
the node ordering defaulting to defaultNodeOrdering
.
the edge ordering defaulting to defaultEdgeOrdering
.
Prepares and calls plusPlus
or minusMinus
.
Prepares and calls plusPlus
or minusMinus
.
Checks whether a given node or edge is contained in this graph.
Checks whether a given node or edge is contained in this graph.
the node or edge the existence of which is to be checked
true if elem
is contained in this graph
The degree set of this graph projected onto a map.
The degree set of this graph projected onto a map. The keys of the map are the degrees in decreasing order while the values are the number of inner nodes having the degree of the corresponding key.
The degree sequence of this graph projected onto a sequence of tuples.
The degree sequence of this graph projected onto a sequence of tuples. The first elements of the tuples are the degrees in non-increasing order while the second elements are the corresponding inner nodes.
The degree set of this graph projected onto a map.
The degree set of this graph projected onto a map. The keys of the map are the degrees in decreasing order while the values are sets of the corresponding inner nodes.
The degree sequence of this graph, that is the non-increasing sequence of degrees over all nodes.
The degree sequence of this graph, that is the non-increasing sequence of degrees over all nodes.
The degree set of this graph, that is the decreasing set of unique degrees over all nodes.
The degree set of this graph, that is the decreasing set of unique degrees over all nodes. Same as degreeSeq without duplicates.
Graph
instances are equal if their nodes and edges turned
to outer nodes and outer edges are equal.
Graph
instances are equal if their nodes and edges turned
to outer nodes and outer edges are equal. Any TraversableOnce
instance may also be equal to this graph if its set representation
contains equalling outer nodes and outer edges. Thus the following
expressions hold:
Graph(1~2, 3) == List(1~2, 3) Graph(1~2, 3) == List(1, 2, 2, 3, 2~1)
The first test is false
because of the failing nodes 1
and 2
.
The second is true because of duplicate elimination and undirected edge equivalence.
Searches for an edge node equaling to outerEdge
in this graph.
Searches for an edge node equaling to outerEdge
in this graph.
the outer edge to search for in this graph.
Some
of the inner edge found or None
.
Searches for an inner node equaling to outerNode
in this graph.
Searches for an inner node equaling to outerNode
in this graph.
Some
of the inner node found or None
.
Finds a cycle in this
graph and calls visitor
for each inner element
visited during the search.
Finds a cycle in this
graph and calls visitor
for each inner element
visited during the search.
Use componentTraverser
to pass non-default arguments.
Finds a cycle in this
graph.
Finds a cycle in this
graph.
Use componentTraverser
to pass non-default arguments.
Searches for an inner edge equaling to outerEdge
in this graph
which must exist in this graph.
Searches for an inner edge equaling to outerEdge
in this graph
which must exist in this graph.
the outer edge to search for in this graph.
the inner edge if found. Otherwise NoSuchElementException is thrown.
Searches for an inner node equaling to outerNode
in this graph
which must exist in this graph.
Searches for an inner node equaling to outerNode
in this graph
which must exist in this graph.
the outer node to search for in this graph.
the inner node if found. Otherwise NoSuchElementException is thrown.
Searches for an inner edge equaling to outerEdge
in this graph.
Searches for an inner edge equaling to outerEdge
in this graph.
the outer edge to search for in this graph.
the inner edge to return if outerEdge
cannot be found.
the inner edge looked up or default
if no inner edge
equaling to edge
could be found.
Searches for an inner node equaling to outerNode
in this graph.
Searches for an inner node equaling to outerNode
in this graph.
the outer node to search for in this graph.
the inner node to return if outerNode
is not contained.
The inner node looked up or default
if no inner node
equaling to outerNode
could be found.
The size - commonly referred to as ||G|| - of this graph equaling to the number of edges.
The size - commonly referred to as ||G|| - of this graph equaling to the number of edges.
Method size
is reserved for the number of nodes and edges
because Graph
is also SetLike
with set elements being nodes or edges.
Provides a shortcut for predicates involving any graph element.
Provides a shortcut for predicates involving any graph element.
In order to compute a subgraph of this graph, the result of this method
may be passed to any graph-level method requiring a predicate such as
count
, exists
, filter
, filterNot
, forall
etc. For instance
val g = Graph(2~>3, 3~>1, 5) g filter g.having(nodes = _ >= 2) // yields Graph(2, 3, 5, 2~>3)
The predicate that must hold for the nodes.
The predicate that must hold for the edges. If omitted, all edges
between nodes to be included by nodes
will also be included.
A partial function combining the passed predicates.
Populates this graph with nodes
and edges
.
Populates this graph with nodes
and edges
.
The implementing class will typically have a constructor with the same parameters
which is invoked by from
of the companion object.
The isolated (and optionally any other) outer nodes that the node set of this graph is to be populated with.
The outer edges that the edge set of this graph is to be populated with. Nodes being the end of any of these edges will be added to the node set.
Whether this
graph has no cycle.
Whether this
graph has no cycle.
Whether all nodes are pairwise adjacent.
Whether all nodes are pairwise adjacent.
true
if this graph is complete, false
if this graph contains any
independent nodes.
Whether this
graph is connected if it is undirected or
weakly connected if it is directed.
Whether this
graph is connected if it is undirected or
weakly connected if it is directed.
true
if f
is not equivalent to anyEdge
.
true
if f
is not equivalent to anyEdge
.
true
if v
is not equivalent to noEdgeAction
.
true
if v
is not equivalent to noEdgeAction
.
true
if f
is not equivalent to anyNode
.
true
if f
is not equivalent to anyNode
.
true
if v
is not equivalent to noNodeUpAction
.
true
if v
is not equivalent to noNodeUpAction
.
true
if v
is not equivalent to noNodeAction
.
true
if v
is not equivalent to noNodeAction
.
Whether this
graph has at least one cycle.
Whether this
graph has at least one cycle.
true
if this graph has at most 1 node.
true
if this graph has at most 1 node.
Iterates over all nodes and all edges.
Iterates over all nodes and all edges.
iterator containing all nodes and all edges
(Changed in version 2.8.0) Set.map now returns a Set, so it will discard duplicate values.
The degree of the node having the highest degree or 0
if
this graph is empty.
The degree of the node having the highest degree or 0
if
this graph is empty.
The degree of the node having the least degree or 0
if
this graph is empty.
The degree of the node having the least degree or 0
if
this graph is empty.
Implements the heart of --
calling the from
factory method of the companion object.
Implements the heart of --
calling the from
factory method of the companion object.
Note that this method must be reimplemented in each module
having its own factory methods such as constrained
does.
Calculates the nodes
and edges
arguments to be passed to a factory method
when delNodes and delEdges are to be deleted by --
.
Calculates the nodes
and edges
arguments to be passed to a factory method
when delNodes and delEdges are to be deleted by --
.
Default edge visitor doing nothing (non-visitor).
Default edge visitor doing nothing (non-visitor).
Node predicate always returning false
.
Node predicate always returning false
.
Default node visitor doing nothing (non-visitor).
Default node visitor doing nothing (non-visitor).
Default node-up visitor doing nothing (non-visitor).
Default node-up visitor doing nothing (non-visitor).
true
if this graph has at least 2 nodes.
true
if this graph has at least 2 nodes.
The order - commonly referred to as |G| - of this graph equaling to the number of nodes.
The order - commonly referred to as |G| - of this graph equaling to the number of nodes.
Implements the heart of ++
calling the from
factory method of the companion object.
Implements the heart of ++
calling the from
factory method of the companion object.
Note that this method must be reimplemented in each module
having its own factory methods such as constrained
does.
(Changed in version 2.9.0) The behavior of scanRight
has changed. The previous behavior can be reproduced with scanRight.reverse.
Same as asSortedString
but additionally prefixed and parenthesized by stringPrefix
.
Same as asSortedString
but additionally prefixed and parenthesized by stringPrefix
.
Ensures sorted nodes/edges unless this Graph
has more than 100 elements.
Ensures sorted nodes/edges unless this Graph
has more than 100 elements.
See also asSortedString
and toSortedString
.
The total degree of this graph equaling to the sum
of the degrees over all nodes or 0
if this graph is empty.
The total degree of this graph equaling to the sum
of the degrees over all nodes or 0
if this graph is empty.
the degree function to apply
to the nodes defaulting to Degree
. Non-default predefined
degree functions are InDegree
and OutDegree
.
selects nodes to be included by their degree.
(adjacencyListBase: any2stringadd[AdjacencyListBase[N, E, This]]).+(other)
(adjacencyListBase: (Param[Param[N, E], EI]) ⇒ Boolean).andThen(g)
(adjacencyListBase: (Param[Param[N, E], EI]) ⇒ Boolean).apply(v1)
(adjacencyListBase: (Param[Param[N, E], EI]) ⇒ Boolean).compose(g)
(adjacencyListBase: MonadOps[Param[N, E]]).filter(p)
(adjacencyListBase: MonadOps[Param[N, E]]).flatMap(f)
(adjacencyListBase: MonadOps[Param[N, E]]).map(f)
(adjacencyListBase: OuterNode[AdjacencyListBase[N, E, This]]).stringPrefix
(adjacencyListBase: OuterNode[AdjacencyListBase[N, E, This]]).toString()
(adjacencyListBase: (Param[Param[N, E], EI]) ⇒ Boolean).toString()
(adjacencyListBase: MonadOps[Param[N, E]]).withFilter(p)
Finds a cycle in this
graph taking optional filters and visitors into account.
Finds a cycle in this
graph taking optional filters and visitors into account., if any.
Predicate to filter the nodes to be visited during traversal.
The default value is anyNode
, that is no filtering.
A return of true
signals that the traversal is to be canceled.
Predicate to filter the edges to be visited during traversal.
The default value is anyEdge
meaning that no filtering takes place.
A positive value limiting the number of layers for Bfs respectively
the number of consecutive child visits before siblings are visited for Dfs.
0
, the default value, indicates that the traversal should have
an unlimited depth meaning that it will be continued until either
it's canceled or all nodes have been visited.
Function to be called on visiting a node for the first time
during a traversal. It can mutate the node or carry out any other side effect.
The default value is the empty function noNodeAction
. Alternatively, an instance of ExtendedNodeVisitor
may be passed to obtain additional state information such as the current
depth. The concrete type of the last argument, the informer
depends on the underlying implementation so you need to match against it. Concerning this method please match against
scalax.collection.GraphTraversalImpl.WgbInformer.
Function to be called on visiting an edge.
It can mutate the node or carry out any other side effect.
The default value is the empty function noEdgeAction
.
If a NodeOrdering
or EdgeOrdering
different from noOrdering
is supplied
neighbor nodes will be sorted during the traversal. Thus it is guaranteed that
the smaller an element's ranking the sooner it will be processed. In case of
EdgeOrdering
it is guaranteed that the smaller an edge's ranking the sooner
its relevant end(s) will be processed.
A cycle or None
if either
this
graph orthis
graph but due to the given
filtering conditions or a Cancel
return by a visitor this cycle
had to be disregarded.
(Since version 1.8.0) Use componentTraverser instead.
Implementation of an incident list based graph representation. This trait is common to both the immutable and mutable variants. An incidence list based representation speeds up traversing the graph along its paths by storing the list of connecting edges at each node.