class VirtualUnidirectionalGraph extends AbstractGraph[Int]
Efficient representation of a mutable graph where the nodes are identified using consecutive int values (0,1,3,...). This graph in particular supports the case where many nodes do not have successors. Furthermore, computing the strongly connected components is particular efficient as no transformations are required since we already use int values for the nodes.
Thread Safety
This class is not thread-safe!
- Source
- VirtualUnidirectionalGraph.scala
Some nodes may have no successors:
val edges = Map((0 -> List(1)),(1 -> List(0)),(2 -> List(3))/*,(3 -> List())*/) val successors : Int => Iterator[Int] = (i : Int) => { edges.get(i) match {case Some(successors) => successors.toIterator; case _ => Iterator.empty } } val vg = new org.opalj.graphs.VirtualUnidirectionalGraph(4/*max id of a node +1 */,successors)
- Alphabetic
- By Inheritance
- VirtualUnidirectionalGraph
- AbstractGraph
- Function1
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new VirtualUnidirectionalGraph(verticesCount: Int, successors: (Int) => IntIterator)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def andThen[A](g: (IterableOnce[Int]) => A): (Int) => A
- Definition Classes
- Function1
- Annotations
- @unspecialized()
- def apply(s: Int): IterableOnce[Int]
Returns a given node's successor nodes.
Returns a given node's successor nodes.
- Definition Classes
- VirtualUnidirectionalGraph → AbstractGraph → Function1
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- def compose[A](g: (A) => Int): (A) => IterableOnce[Int]
- Definition Classes
- Function1
- Annotations
- @unspecialized()
- 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() @IntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def nonEmpty: Boolean
- Definition Classes
- VirtualUnidirectionalGraph → AbstractGraph
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- def rootNodes(ignoreSelfRecursiveDependencies: Boolean = true): Set[Int]
Returns the set of nodes with no incoming dependencies; self-dependencies are optionally ignored.
Returns the set of nodes with no incoming dependencies; self-dependencies are optionally ignored.
- ignoreSelfRecursiveDependencies
If true self-dependencies are ignored. This means that nodes that have a self dependency are considered as being root nodes if they have no further incoming dependencies.
- returns
The set of root nodes which can be freely mutated.
- Definition Classes
- AbstractGraph
scala> val g = org.opalj.graphs.Graph.empty[AnyRef] += ("a" -> "b") += ("b" -> "c") += ("b" -> "d") += ("a" -> "e") += ("f" -> "e") += ("y" -> "y") += ("a" -> "f") g: org.opalj.graphs.Graph[AnyRef] = Graph{ d => {} c => {} a => {f,e,b} b => {d,c} e => {} y => {y} f => {e} } scala> g.rootNodes(ignoreSelfRecursiveDependencies = true) res1: scala.collection.mutable.Set[AnyRef] = Set(a) scala> g.rootNodes(ignoreSelfRecursiveDependencies = false) res2: scala.collection.mutable.Set[AnyRef] = Set(y, a)
Example: - def sccs(filterSingletons: Boolean = false): List[List[Int]]
- val successors: (Int) => IntIterator
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def theSuccessors(s: Int): IntIterator
Returns a node's successors.
- def toDot(dir: String = "forward", ranksep: String = "1.0", rankdir: String = "TB"): String
- Definition Classes
- AbstractGraph
- def toNodes: Iterable[Node]
- Definition Classes
- AbstractGraph
- def toString(): String
- Definition Classes
- AbstractGraph → Function1 → AnyRef → Any
- def vertices: Range
- Definition Classes
- VirtualUnidirectionalGraph → AbstractGraph
- val verticesCount: Int
- 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])
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated