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.
- N
the type of the nodes (ends) of this edge.
- Alphabetic
- By Inheritance
- Edge
- Equals
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def _1: N
The first node of this edge.
- abstract def _2: N
The second node of this edge.
- abstract def arity: Int
Number of the endpoints of this edge.
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.
- abstract def ends: Several[N]
The endpoints of this edge, in other words the nodes this edge connects.
- abstract def hasSource(pred: (N) => Boolean): Boolean
true
if any source end of this edge fulfillspred
. - abstract def hasSource[M >: N](node: M): Boolean
true
ifnode
is a source of this edge.true
ifnode
is a source of this edge. In case this edge is undirected this method maps toisAt
. - abstract def hasTarget(pred: (N) => Boolean): Boolean
true
if any target end of this edge fulfillspred
. - abstract def hasTarget[M >: N](node: M): Boolean
true
ifnode
is a target of this edge.true
ifnode
is a target of this edge. In case this edge is undirected this method maps toisAt
. - abstract def isAt(pred: (N) => Boolean): Boolean
true
if any end of this edge fulfillspred
. - abstract def isAt[M >: N](node: M): Boolean
true
ifnode
is incident with this edge. - abstract def isDirected: Boolean
Whether this edge is directed.
- abstract def isHyperEdge: Boolean
Whether this edge's type is hyperedge meaning that it may have more than two ends.
- abstract def isLooping: Boolean
Whether this edge produces a self-loop.
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.
- abstract def matches(p1: (N) => Boolean, p2: (N) => Boolean): Boolean
true
if
a) two distinct ends of this undirected edge exist for whichp1
andp2
hold or
b)p1
holds for a source andp2
for a target of this directed edge. - abstract def matches[M >: N](n1: M, n2: M): Boolean
true
iftrue
if- being an undirected edge, both
n1
andn2
are at this edge - being a directed edge,
n1
is a source andn2
a target of this edge.
- being an undirected edge, both
- abstract def node(n: Int): N
The n'th node of this edge.
The n'th node of this edge.
- Exceptions thrown
IllegalArgumentException
ifn
does not meet0 <= n < arity
.
- abstract def sources: OneOrMore[N]
All source ends of this edge.
- abstract def targets: OneOrMore[N]
All target ends of this edge.
- abstract def withSources[U](f: (N) => U): Unit
Applies
f
to all source ends of this edge without any memory allocation. - abstract def withTargets[U](f: (N) => U): Unit
Applies
f
to the target ends of this edge without any memory allocation.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (Edge[N], B)
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def canEqual(that: Any): Boolean
- Definition Classes
- Edge → Equals
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def contains[M >: N](node: M): Boolean
Same as
isAt
.Same as
isAt
.- Annotations
- @inline()
- def customMsgPrefix: String
- Attributes
- protected
- def ensuring(cond: (Edge[N]) => Boolean, msg: => Any): Edge[N]
- def ensuring(cond: (Edge[N]) => Boolean): Edge[N]
- def ensuring(cond: Boolean, msg: => Any): Edge[N]
- def ensuring(cond: Boolean): Edge[N]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isLabeled: Boolean
- final def isUndirected: Boolean
Whether this edge is undirected.
Whether this edge is undirected.
- Annotations
- @inline()
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def nonHyperEdge: Boolean
Whether this edge has exactly two ends.
Whether this edge has exactly two ends.
- Annotations
- @inline()
- final def nonLooping: Boolean
Same as
! looping
.Same as
! looping
.- Annotations
- @inline()
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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 inExtendedKey
and addsweight
tokeyAttributes
.
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from Edge[N] toStringFormat[Edge[N]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (Edge[N], B)
- Implicit
- This member is added by an implicit conversion from Edge[N] toArrowAssoc[Edge[N]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.
Welcome to the Graph for Scala API reference. Some suggested entry points:
AnyGraph
immutable.Graph
and its inner nodesmutable.Graph
and its inner nodes.edges
package and its subpackageshyperedges
package and its subpackages.labeled edges
packagemultilabeled edges
packagelabeled hyperedges
packagemultilabeled hyperedges
packageordered labeled hyperedges
packageordered multilabeled hyperedges
objectgeneric
package.GraphTraversal
andTraverserInnerNode
.RandomGraph
.GraphGen
.