AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
aud.example.graph.MyGraph Class Reference

graph based on aud.graph.GraphAM More...

+ Inheritance diagram for aud.example.graph.MyGraph:
+ Collaboration diagram for aud.example.graph.MyGraph:

Public Member Functions

 MyGraph (boolean directed)
 create empty graph More...
 
 MyGraph (boolean directed, File filename)
 read graph from file using GraphParser More...
 
AbstractGraph< AbstractNode, AbstractEdgegetAbstractGraph ()
 view this graph as an AbstractGraph More...
 
GraphvizDecorator getDecorator ()
 
- Public Member Functions inherited from aud.graph.GraphAM< MyNode, MyEdge >
 GraphAM (Node nodeGenerator, Edge edgeGenerator, boolean directed)
 Create graph. More...
 
boolean isDirected ()
 
Node addNode ()
 
Edge addEdge (Node source, Node destination)
 
int getNumNodes ()
 
Node getSomeNode ()
 
Iterator< Node > iterator ()
 
Edge getEdge (Node source, Node destination)
 
Vector< Edge > getInEdges (Node node)
 
Vector< Edge > getOutEdges (Node node)
 
void removeNode (Node node)
 
void removeEdge (Edge edge)
 
Iterator< Edge > getEdgeIterator ()
 

Additional Inherited Members

- Protected Member Functions inherited from aud.graph.GraphAM< MyNode, MyEdge >
Node check (Node node)
 
Edge check (Edge edge)
 

Detailed Description

graph based on aud.graph.GraphAM

See also
MyNode
MyEdge

Definition at line 11 of file MyGraph.java.

Constructor & Destructor Documentation

◆ MyGraph() [1/2]

aud.example.graph.MyGraph.MyGraph ( boolean  directed)

create empty graph

Definition at line 16 of file MyGraph.java.

16 {
17 super(new MyNode(),new MyEdge(),directed);
18 }

◆ MyGraph() [2/2]

aud.example.graph.MyGraph.MyGraph ( boolean  directed,
File  filename 
)

read graph from file using GraphParser

Definition at line 20 of file MyGraph.java.

20 {
21 this(directed);
22 String text=Sys.readFile(filename);
23 new GraphParser(getAbstractGraph()).parse(text);
24 }
AbstractGraph< AbstractNode, AbstractEdge > getAbstractGraph()
view this graph as an AbstractGraph
Definition: MyGraph.java:29
System related utilities.
Definition: Sys.java:58
static String readFile(File file)
read entire file and return contents as String
Definition: Sys.java:216

References aud.example.graph.MyGraph.getAbstractGraph(), aud.example.graph.GraphParser.parse(), and aud.util.Sys.readFile().

+ Here is the call graph for this function:

Member Function Documentation

◆ getAbstractGraph()

AbstractGraph< AbstractNode, AbstractEdge > aud.example.graph.MyGraph.getAbstractGraph ( )

view this graph as an AbstractGraph

Definition at line 29 of file MyGraph.java.

29 {
30 // require weird cast -- java generics suck!
31 return (AbstractGraph< AbstractNode,AbstractEdge>) (Object) this;
32 }
Interface to a graph.

Referenced by aud.example.graph.RetroMaze.main(), aud.example.graph.TraversalExample.main(), and aud.example.graph.MyGraph.MyGraph().

+ Here is the caller graph for this function:

◆ getDecorator()

GraphvizDecorator aud.example.graph.MyGraph.getDecorator ( )

Definition at line 34 of file MyGraph.java.

34 {
35 return decorator_;
36 }

Referenced by aud.example.graph.TraversalExample.main().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: