示例#1
0
int addNode(Graph *graph, bool root, HostLabel label) 
{
   Node node;
   node.root = root;
   node.label = label;
   node.first_out_edge = -1;
   node.second_out_edge = -1;
   node.first_in_edge = -1;
   node.second_in_edge = -1;
   node.out_edges = makeIntArray(0);
   node.in_edges = makeIntArray(0);
   node.outdegree = 0;
   node.indegree = 0;
   node.matched = false;

   int index = addToNodeArray(&(graph->nodes), node);
   if(root) addRootNode(graph, index);
   graph->number_of_nodes++;
   return index; 
}
示例#2
0
static NodeArray makeNodeArray(int initial_capacity)
{
   NodeArray array;
   array.capacity = initial_capacity;
   array.size = 0;
   array.items = calloc(initial_capacity, sizeof(Node));
   if(array.items == NULL)
   {
      print_to_log("Error (makeNodeArray): malloc failure.\n");
      exit(1);
   }
   array.holes = makeIntArray(16);
   return array;
}
示例#3
0
文件: group.c 项目: Fuco1/yafmp
Group* makeGroup() {
    Group* group = malloc(sizeof(Group));
    group->words = makeIntArray(6);
    group->prev = NULL;
    return group;
}