-
Notifications
You must be signed in to change notification settings - Fork 0
SIPL Grapher
First of all an example of a main with a basic usage of Grapher:
#include "Graphs_Ut.h"
int main(void) {
Graph test(5);
Interval_Graph testB;
test.Add_Edge(0, 1);
test.Add_Edge(0, 2);
test.Add_Edge(1, 1);
test.Add_Edge(4, 1);
testB.Add_Interval(1, 5);
testB.Add_Interval(2, 5);
testB.Add_Interval(1, 3);
testB.Add_Interval(1, 9);
testB.Print_Graph_Intervals();
testB.Output_Graph_Image();
test.Export_Graph_Image("Comp");
system("Graph_Output.jpg");
return(1);
Grapher currently supports regular graph theory graphs , which can be initiated by creating an object of class "Graph" and interval graphs which can be initiated by creating an object of class "Interval_Graph" each one of the class possess a set of methods for adding and calculating graph information as well as a method which will output a corresponding image , if using an object of type "Graph" the output image will be a illustration of a graph with differently colored vertices and edges connect them as specified by user.
The "Interval_Class" will output an image which will display an illustration of the interval graph itself on a Cartesian coordinate system , along with all the information calculated using the graph data , information like the number of edges in the interval graph ,the maximum degree , the minimum degree, chromatic number of the interval graph and the same information for the graphs compliment.
An image created of an Interval Graph made from intervals loaded to Interval_Graph class.
A Regular Graph Illustration:
- Example of a graph G made from 4 vertices and 4 edges between {V0-V1,V0-V3,V1-V2,V1-V3};
- the method also allows the user to choose if to out put the regular graph or its complement ,here is the complement of the above example :
-
Graph class methods:
void Add_Edge(int const &Vr, int const &Vl);
void Print_Edges();
void Export_Graph_Image(const char *type);
-
Interval_Graph class methods:
void Add_Interval(int left, int right);
void Print_Graph_Intervals()const;
void Run_Analysis();
void Print_Adjacency_Matirx();
void Print_Graph_Stats();
void Output_Graph_Image();
- Create an object of class Graph(for you convenience set the number of vertices by passing the amount to the constructor)
Graph MyGraph(5)
this will create a graph with 5 vertices (V0,V1,V2,V3,V4)
- Connecting vertices with edges
MyGraph.Add_Edge(0,4)
the following will created an edge between V0 and V4. Please keep in mind that that there are maximum (n*(n-1))/2 edge in any graph ,where n is the number of vertices.
- Reviewing edges ,printing to console
MyGraph.Print_Edges();
the following will print to console all currently loaded edges.
- Creating an illustration of the graph:
MyGraph.Export_Graph_Image("SelectedName");
- Create an object of class Interval_Graph