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.
The empty ElemOrdering.
Ordering for the path dependent type NodeT.
Represents a path in this graph listing the nodes and connecting edges on it with the following syntax:
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.
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.
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 limits the number of layers for BFS respectively
the number of consecutive child visits before siblings are visited for DFS.
0
- the default - indicates that the traversal should have
an unlimited depth meaning that it will be continued either until
it's canceled by nodeVisitor
or until 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
.
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
a) there exists no cycle in this
graph or
b) there exists a cycle in this
graph but due to the given
filtering conditions or a Cancel
return by a visitor this cycle
had to be disregarded.
The companion object of This
.
The companion object of This
.
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
.
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.
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 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 edge are deleted along with those incident nodes which would become edge-less
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 edge
in this graph.
Searches for an edge node equaling to edge
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 node
in this graph.
Searches for an inner node equaling to node
in this graph.
The outer node to search for in this graph.
Some
of the inner node found or None
.
Same as findCycle(...)
with default arguments.
Same as findCycle(...)
with default arguments.
Searches for an inner edge equaling to edge
in this graph
which must exist in this graph.
Searches for an inner edge equaling to edge
in this graph
which must exist in this graph.
The outer edge to search for in this graph.
The inner edge looked up. If no inner edge
equaling to edge
is found NoSuchElementException is raised.
Searches for an inner node equaling to node
in this graph
which must exist in this graph.
Searches for an inner node equaling to node
in this graph
which must exist in this graph.
The outer node to search for in this graph.
The inner node looked up. If no inner node
equaling to node
is found NoSuchElementException is raised.
Searches for an inner edge equaling to edge
in this graph.
Searches for an inner edge equaling to edge
in this graph.
The outer edge to search for in this graph.
The inner edge to return if edge
could not 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 node
in this graph.
Searches for an inner node equaling to node
in this graph.
The outer node to search for in this graph.
The inner node to return if node
could not be found.
The inner node looked up or default
if no inner node
equaling to node
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 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 filter
is not equivalent to anyEdge
.
true
if filter
is not equivalent to anyEdge
.
true
if visitor
is not equivalent to noEdgeAction
.
true
if visitor
is not equivalent to noEdgeAction
.
true
if filter
is not equivalent to anyNode
.
true
if filter
is not equivalent to anyNode
.
true
if visitor
is not equivalent to noNodeUpAction
.
true
if visitor
is not equivalent to noNodeUpAction
.
true
if visitor
is not equivalent to noNodeAction
.
true
if visitor
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.
(Changed in version 2.9.0) transpose
throws an IllegalArgumentException
if collections are not uniformly sized.
(Since version 2.10.0) use fold instead
The main trait for immutable graphs bundling the functionality of traits concerned with specific aspects.
the type of the nodes (vertices) in this graph.
the kind of the edges in this graph.