AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
MyGraph.java
Go to the documentation of this file.
1package aud.example.graph;
2
3import aud.graph.*;
4import aud.util.*;
5import java.io.File;
6
11public class MyGraph extends GraphAM<MyNode,MyEdge> {
12
13 MyDecorator decorator_ = new MyDecorator(this);
14
16 public MyGraph(boolean directed) {
17 super(new MyNode(),new MyEdge(),directed);
18 }
20 public MyGraph(boolean directed,File filename) {
21 this(directed);
22 String text=Sys.readFile(filename);
24 }
25
27 @SuppressWarnings("unchecked")
30 // require weird cast -- java generics suck!
31 return (AbstractGraph< AbstractNode,AbstractEdge>) (Object) this;
32 }
33
34 @Override public GraphvizDecorator getDecorator() {
35 return decorator_;
36 }
37}
Parse text to build graph.
void parse(String input)
parse input
edge with all possible attributes that we require ;-)
Definition: MyEdge.java:6
graph based on aud.graph.GraphAM
Definition: MyGraph.java:11
MyGraph(boolean directed, File filename)
read graph from file using GraphParser
Definition: MyGraph.java:20
MyGraph(boolean directed)
create empty graph
Definition: MyGraph.java:16
GraphvizDecorator getDecorator()
Definition: MyGraph.java:34
AbstractGraph< AbstractNode, AbstractEdge > getAbstractGraph()
view this graph as an AbstractGraph
Definition: MyGraph.java:29
node with all possible attributes that we require ;-)
Definition: MyNode.java:6
Interface to edges of a graph.
Interface to a graph.
Interface to nodes of a graph.
Graph implementation based on adjacency matrix.
Definition: GraphAM.java:15
Decorator for items of Graphvizable objects.
System related utilities.
Definition: Sys.java:58
static String readFile(File file)
read entire file and return contents as String
Definition: Sys.java:216
Graph data structures and algorithms.
utilities (not related to AuD lecture)
Definition: Colormap.java:1
AuD lecture: Data structures, algorithms, examples.
Definition: A234Tree.java:1