Exemple #1
0
Graph * get_full_graph(int count)
{
	ARGEdit ed;  // The object used to create the graph
	// Insert the three nodes
	for(int i=0; i<count; i++)
	  ed.InsertNode(NULL); // The inserted node will have index i.
						   // NULL stands for no semantic attribute.
	// Insert the edges
	for(int i=0; i<count; i++)
	  for(int j=0; j<count; j++)
		if (i!=j)
			  ed.InsertEdge(i, j, NULL); // NULL stands for no sem. attribute.

	return new Graph(&ed);
}
Exemple #2
0
Graph* readGraphBinary(const char* filename) {
	ARGEdit ed;

    ifstream in (filename, ios::in|ios::binary);
    int n = r(in);	// number of vertices
    for(int i = 0; i < n; i++)
    	  ed.InsertNode(NULL);

    for (int i = 0; i < n; i++) {
    	int cnt = r(in);
        for (int j = 0; j < cnt; j++) {
            int k = r(in);
            ed.InsertEdge(i, k, NULL);
        }
    }

    in.close();
    return new Graph(&ed);
}