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 ``` ``` ```

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

```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`

`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`

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Informasi yang saya butuhkan tidak ada" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Terlalu rumit/langkahnya terlalu banyak" },{ "type": "thumb-down", "id": "outOfDate", "label":"Sudah usang" },{ "type": "thumb-down", "id": "translationIssue", "label":"Masalah terjemahan" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Masalah kode / contoh" },{ "type": "thumb-down", "id": "otherDown", "label":"Lainnya" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Mudah dipahami" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Memecahkan masalah saya" },{ "type": "thumb-up", "id": "otherUp", "label":"Lainnya" }]