Google berkomitmen untuk mendorong terwujudnya keadilan ras bagi komunitas Kulit Hitam. Lihat caranya.
Tetap teratur dengan koleksi Simpan dan kategorikan konten berdasarkan preferensi Anda.

DirectedGraph

public class DirectedGraph
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.DirectedGraph<V>


A directed unweighted graphs implementation. The vertex type can be specified.

Summary

Public constructors

DirectedGraph()

Public methods

void addEdge(V from, V to)

Add an edge to the graph; if either vertex does not exist, it's added.

void addVertice(V vertex)

Add a vertex to the graph.

boolean contains(V vertex)

True if graph contains vertex.

boolean isDag()

True if graph is a dag (directed acyclic graph).

void removeEdge(V from, V to)

Remove an edge from the graph.

String toString()

String representation of graph.

Public constructors

DirectedGraph

public DirectedGraph ()

Public methods

addEdge

public void addEdge (V from, 
                V to)

Add an edge to the graph; if either vertex does not exist, it's added. This implementation allows the creation of multi-edges and self-loops.

Parameters
from V

to V

addVertice

public void addVertice (V vertex)

Add a vertex to the graph. Inop if vertex is already in graph.

Parameters
vertex V

contains

public boolean contains (V vertex)

True if graph contains vertex. False otherwise.

Parameters
vertex V

Returns
boolean

isDag

public boolean isDag ()

True if graph is a dag (directed acyclic graph).

Returns
boolean

removeEdge

public void removeEdge (V from, 
                V to)

Remove an edge from the graph.

Parameters
from V

to V

Throws
IllegalArgumentException if either vertex doesn't exist.

toString

public String toString ()

String representation of graph.

Returns
String