Edge

scalax.collection.generic.Edge
See theEdge companion object
sealed trait Edge[+N] extends Equals

Base template for all edges in a Graph.

Library-provided edges are immutable for both mutable and immutable Graph. However, when using mutable graphs with labeled edges where labels are mutable with respect to your use case, you might want to make your label mutable accordingly. Otherwise a much less efficient edge replacement would be necessary.

Type parameters

N

the type of the nodes (ends) of this edge.

Attributes

Companion
object
Graph
Supertypes
trait Equals
class Object
trait Matchable
class Any
Known subtypes
trait AnyEdge[N]
trait AnyDiEdge[N]
class LDiEdge[N, L]
class LDiEdge[N, L]
class AbstractDiEdge[N]
trait AbstractGenericDiEdge[N, CC]
class WDiEdge[N]
class WDiEdge[N]
class DiEdge[N]
trait AnyUnDiEdge[N]
class LUnDiEdge[N, L]
class LUnDiEdge[N, L]
class WUnDiEdge[N]
class WUnDiEdge[N]
class UnDiEdge[N]
class AbstractUnDiEdge[N]
trait AnyHyperEdge[N]
class HyperEdge[N]
class HyperEdge[N]
class LHyperEdge[N, L]
class LHyperEdge[N, L]
class LHyperEdge[N, L]
class LHyperEdge[N, L]
trait AnyDiHyperEdge[N]
class DiHyperEdge[N]
class DiHyperEdge[N]
class LDiHyperEdge[N, L]
class LDiHyperEdge[N, L]
class LDiHyperEdge[N, L]
class LDiHyperEdge[N, L]
Show all

Members list

Value members

Abstract methods

def arity: Int

Number of the endpoints of this edge. At least two nodes are joined. In case of a hook, the two nodes are identical. Hyperedges may link more than two nodes.

Number of the endpoints of this edge. At least two nodes are joined. In case of a hook, the two nodes are identical. Hyperedges may link more than two nodes.

Attributes

def ends: Several[N]

The endpoints of this edge, in other words the nodes this edge connects.

The endpoints of this edge, in other words the nodes this edge connects.

Attributes

def hasSource[M >: N](node: M): Boolean

true if node is a source of this edge. In case this edge is undirected this method maps to isAt.

true if node is a source of this edge. In case this edge is undirected this method maps to isAt.

Attributes

def hasSource(pred: N => Boolean): Boolean

true if any source end of this edge fulfills pred.

true if any source end of this edge fulfills pred.

Attributes

def hasTarget[M >: N](node: M): Boolean

true if node is a target of this edge. In case this edge is undirected this method maps to isAt.

true if node is a target of this edge. In case this edge is undirected this method maps to isAt.

Attributes

def hasTarget(pred: N => Boolean): Boolean

true if any target end of this edge fulfills pred.

true if any target end of this edge fulfills pred.

Attributes

def isAt[M >: N](node: M): Boolean

true if node is incident with this edge.

true if node is incident with this edge.

Attributes

def isAt(pred: N => Boolean): Boolean

true if any end of this edge fulfills pred.

true if any end of this edge fulfills pred.

Attributes

Whether this edge is directed.

Whether this edge is directed.

Attributes

Whether this edge's type is hyperedge meaning that it may have more than two ends.

Whether this edge's type is hyperedge meaning that it may have more than two ends.

Attributes

Whether this edge produces a self-loop. In case of a non-hyperedge, a loop is given if the incident nodes are equal. In case of a directed hyperedge, a loop is given if any of the targets is included in the sources. In case of an undirected hyperedge, a loop is given if any of the ends is a duplicate.

Whether this edge produces a self-loop. In case of a non-hyperedge, a loop is given if the incident nodes are equal. In case of a directed hyperedge, a loop is given if any of the targets is included in the sources. In case of an undirected hyperedge, a loop is given if any of the ends is a duplicate.

Attributes

def matches[M >: N](n1: M, n2: M): Boolean

true if a. being an undirected edge, both n1 and n2 are at this edge a. being a directed edge, n1 is a source and n2 a target of this edge.

true if a. being an undirected edge, both n1 and n2 are at this edge a. being a directed edge, n1 is a source and n2 a target of this edge.

Attributes

def matches(p1: N => Boolean, p2: N => Boolean): Boolean

true if
a) two distinct ends of this undirected edge exist for which p1 and p2 hold or
b) p1 holds for a source and p2 for a target of this directed edge.

true if
a) two distinct ends of this undirected edge exist for which p1 and p2 hold or
b) p1 holds for a source and p2 for a target of this directed edge.

Attributes

def node(n: Int): N

The n'th node of this edge.

The n'th node of this edge.

Attributes

Throws
IllegalArgumentException

if n does not meet 0 <= n < arity.

def node1: N

The first node of this edge.

The first node of this edge.

Attributes

def node2: N

The second node of this edge.

The second node of this edge.

Attributes

def sources: OneOrMore[N]

All source ends of this edge.

All source ends of this edge.

Attributes

def targets: OneOrMore[N]

All target ends of this edge.

All target ends of this edge.

Attributes

def withSources[U](f: N => U): Unit

Applies f to all source ends of this edge without any memory allocation.

Applies f to all source ends of this edge without any memory allocation.

Attributes

def withTargets[U](f: N => U): Unit

Applies f to the target ends of this edge without any memory allocation.

Applies f to the target ends of this edge without any memory allocation.

Attributes

Concrete methods

override def canEqual(that: Any): Boolean

Attributes

Definition Classes
final def contains[M >: N](node: M): Boolean

Same as isAt.

Same as isAt.

Attributes

final def isUndirected: Boolean

Whether this edge is undirected.

Whether this edge is undirected.

Attributes

final def nonHyperEdge: Boolean

Whether this edge has exactly two ends.

Whether this edge has exactly two ends.

Attributes

final def nonLooping: Boolean

Same as ! isLooping.

Same as ! isLooping.

Attributes

def weight: Double

The weight of this edge with a default of 1.

The weight of this edge with a default of 1.

Note that weight is normally not part of the edge key (hashCode). As a result, edges with different weights connecting the same nodes will be evaluated as equal and thus added once and only once to the graph. In case you need multi-edges based on different weights you should define a custom edge class that mixes in ExtendedKey and adds weight to keyAttributes.

Attributes