/usr/include/yalecad/graph.h is in libycadgraywolf-dev 0.1.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | /*-----------------------------------------------------------------
FILE: Graph.h
DESCRIPTION:Graph include file for set of generic graph routines
CONTENTS:
DATE: Jun 01, 1991
REVISIONS:
----------------------------------------------------------------- */
#ifndef YGRAPH_H
#define YGRAPH_H
#ifndef lint
static char YgraphId[] = "@(#) Graph.h version 1.8 8/19/91";
#endif
#include <yalecad/base.h>
#include <yalecad/deck.h>
#include <yalecad/dset.h>
#include <yalecad/rbtree.h>
#ifndef GRAPH_DEFINED
typedef struct graph *YGRAPHPTR;
typedef struct graph_node *YNODEPTR;
typedef struct graph_edge *YEDGEPTR;
#endif
#define YGRAPH_DIRECTED 1
#define YGRAPH_NONDIRECTED 0
/*-------------------------------------------------------------
Ygraph_init: Initialize a graph.
User must make either make the compare_edge function unique
or set compare_edge equal to NULL
The user can set an edge's weight statically.
Or, the use can set an edge's weight dynamicallly.
Thus, the user edge weight function is optional and only
should be used if the user need dynamic edge weights.
-------------------------------------------------------------*/
extern YGRAPHPTR Ygraph_init(P4(INT(*compare_node)(),
INT(*compare_edge)(),
INT(*user_edge_weight)(),
INT flags));
/*
Arguments:
INT (*compare_node)() - users node data comparison function
INT (*compare_edge)() - users edge data comparicson function
INT (*user_edge_weight)() - users edge weight function
INT flags - the bits in the field allow for things like directed edges
and redundant edges.
Function:
This function initializes the data structures used by the various graphics
routines. In order to use all of the graph routines, the user must create
two functions. The compare_node comparison function should be unique as some of
the graph routines make use of disjoint sets. The compare_edge function
can be anything the user desires, however, the use may want to define
the compare_edge in terms of compare_node so that an edge may be retreived
on the basis of nodeData only.
The bits in the flags variable can be used to turn on directed graph behavior.
The default setting is non directed edges.
Example:
1) myGraph = Ygraph_init( myNodeCompare, myEdgeCompare, 0, 0);
This initializes a graph with non directed edges.
2) myGraph = Ygraph_init( myNodeCompare, myEdgeCompare, 0, YGRAPH_DIRECTED );
This initializes a graph with directed edges.
*/
/*-------------------------------------------------
Ygraph_flagsSet
Set flags for graph operation.
Use YGRAPH_DIRECTED, YGRAPH_NONDIRECTED
-------------------------------------------------*/
INT Ygraph_flagsSet( P2(YGRAPHPTR graph, INT flag) );
/*-------------------------------------------------
Ygraph_nodeInsert: insert a node into the graph
-------------------------------------------------*/
extern YNODEPTR Ygraph_nodeInsert( P2(YGRAPHPTR graph,
VOIDPTR nodeData
));
/*
Arguments:
YGRAPHPTR graph - the graph created with Ygraph_init();
INT node - identification of node
VOIDPTR nodeData - users optional node Data
Function:
This routine inserts a node into the graph data structure.
A new node is not created if the node already exists.
Example:
1) Ygraph_nodeInsert( myGraph, 3, myNodeData);
This creates a node with id 3.
*/
/*--------------------------------------------------
Ygraph_edgeDelete: free edges from data structure
--------------------------------------------------*/
extern VOID Ygraph_edgeDelete(P3(YGRAPHPTR graph,YEDGEPTR edge,VOID (*userEdgeFree)()));
/*-------------------------------------------------
Ygraph_edgeInsert: insert an edge into the graph
The new YEDGEPTR is returned.
If the edge already existed, NULL is returned.
-------------------------------------------------*/
extern YEDGEPTR Ygraph_edgeInsert( P5(YGRAPHPTR graph,
VOIDPTR edgeData,
INT edgeWeight,
VOIDPTR nodeData1,
VOIDPTR nodeData2
));
/*
Arguments
YGRAPHPTR graph - the graph created with Ygraph_init();
INT node1 - identification of first node in edge;
INT node2 - identification of second node in edge;
INT edgeWeight - weight of the edge
VOIDPTR edgeData - users optional edge Data
Function:
This routine inserts an edge into the graph data structure.
Redundant edges are not added to the data structure.
If the graph flag YGRAPH_DIRECTED is set, then
only node2 will be in node1's adjacency list.
Otherwise, node1 will also be put into node2's adjacency list.
The new YEDGEPTR is returned. If the edge already exists,
then NULL returned.
Example:
1) Ygraph_insert( myGraph, 3, 5, 20, myEdgeData);
This creates an edge between node 3 and node 5 with a weight of 20
*/
/*---------------------------------------------
empty all nodes and edge from the graph
---------------------------------------------*/
VOID Ygraph_empty(P3(YGRAPHPTR graph,VOID (*nodeDelete)(),VOID (*edgeDelete)()));
/*-------------------------------------------------
Ygraph_nodeCount
-------------------------------------------------*/
extern INT Ygraph_nodeCount( P1( YGRAPHPTR graph ));
/*-------------------------------------------------
Ygraph_edgeCount
-------------------------------------------------*/
extern INT Ygraph_edgeCount( P1( YGRAPHPTR graph ));
/*-------------------------------------------------
Ygraph_edgeWeight
Returns the weigh of an edge
-------------------------------------------------*/
INT Ygraph_edgeWeight( P1 (YEDGEPTR edge) );
/*-------------------------------------------------
Ygraph_edgeWeightSet
Sets the edge weight to weight
-------------------------------------------------*/
INT Ygraph_edgeWeightSet( P2 (YEDGEPTR edge, INT weight) );
/*-------------------------------------------------
Ygraph_edgeNode1Data
-------------------------------------------------*/
int Ygraph_edgeType( P1 (YEDGEPTR edge) );
/*-------------------------------------------------
Ygraph_nodeDegree
-------------------------------------------------*/
extern INT Ygraph_nodeDegree(P1(YNODEPTR node));
/*-------------------------------------------------
Ygraph_nodeFind
-------------------------------------------------*/
extern YNODEPTR Ygraph_nodeFind(P2(YGRAPHPTR graph,VOIDPTR nodeData));
/*-------------------------------------------------
Ygraph_nodeFindClosest - find closest node in graph
Use same functions as rbtree_search_closest.
-------------------------------------------------*/
extern YNODEPTR Ygraph_nodeFindClosest(P3(YGRAPHPTR graph,
VOIDPTR nodeData,INT function));
/*-------------------------------------------------
Ygraph_nodeSuc
-------------------------------------------------*/
extern YNODEPTR Ygraph_nodeSuc(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_nodePred
-------------------------------------------------*/
extern YNODEPTR Ygraph_nodePred(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_edgeFind
-------------------------------------------------*/
extern YEDGEPTR Ygraph_edgeFind(P4(YGRAPHPTR graph,VOIDPTR edgeData,
VOIDPTR node1Data,VOIDPTR node2Data));
/*-------------------------------------------------
Ygraph_edgeFindByNodes
-------------------------------------------------*/
extern YEDGEPTR Ygraph_edgeFindByNodes( P3(YGRAPHPTR graph,
YNODEPTR node1, YNODEPTR node2 ) ) ;
/*-------------------------------------------------
Ygraph_edgeFindByNodeData
-------------------------------------------------*/
extern YEDGEPTR Ygraph_edgeFindByNodeData( P3(YGRAPHPTR graph,
VOIDPTR node1Data, VOIDPTR node2Data ) ) ;
/*-------------------------------------------------
Ygraph_edgeData
-------------------------------------------------*/
extern VOIDPTR Ygraph_edgeData( P1( YEDGEPTR edge));
/*-------------------------------------------------
Ygraph_edgeNode1
-------------------------------------------------*/
extern YNODEPTR Ygraph_edgeNode1( P1(YEDGEPTR edge));
/*-------------------------------------------------
Ygraph_edgeNode2
-------------------------------------------------*/
extern YNODEPTR Ygraph_edgeNode2( P1( YEDGEPTR edge));
/*-------------------------------------------------
Ygraph_edgeNode1Data
-------------------------------------------------*/
extern VOIDPTR Ygraph_edgeNode1Data( P1(YEDGEPTR edge));
/*-------------------------------------------------
Ygraph_edgeNode2Data
-------------------------------------------------*/
extern VOIDPTR Ygraph_edgeNode2Data( P1( YEDGEPTR edge));
/*-------------------------------------------------
Ygraph_nodeData
-------------------------------------------------*/
extern VOIDPTR Ygraph_nodeData( P1( YNODEPTR node));
/*--------------------------------------------------
free and empty the graph
--------------------------------------------------*/
extern VOID Ygraph_free(P3(YGRAPHPTR graph,VOID (*nodeDelete)(),VOID (*edgeDelete)()));
/*-------------------------------------------------
Ygraph_edgeEnumerate
-------------------------------------------------*/
extern YEDGEPTR Ygraph_edgeEnumerate(P2( YGRAPHPTR graph, BOOL startFlag));
/*-------------------------------------------------
Ygraph_edgeEnumeratePush
-------------------------------------------------*/
extern VOID Ygraph_edgeEnumeratePush(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_edgeEnumeratePop
-------------------------------------------------*/
extern VOID Ygraph_edgeEnumeratePop(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_edgeMin
-------------------------------------------------*/
extern YEDGEPTR Ygraph_edgeMin(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_edgeMax
-------------------------------------------------*/
extern YEDGEPTR Ygraph_edgeMax(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_listAdjEdges
-------------------------------------------------*/
extern YEDGEPTR Ygraph_listAdjEdges(P2(YNODEPTR node, INT listNum));
/*-------------------------------------------------
Ygraph_listBackEdges
-------------------------------------------------*/
extern YEDGEPTR Ygraph_listBackEdges(P2(YNODEPTR node, INT listNum));
/*-------------------------------------------------
Ygraph_nodeEnumerate
-------------------------------------------------*/
extern YNODEPTR Ygraph_nodeEnumerate(P2( YGRAPHPTR graph, BOOL startFlag));
/*-------------------------------------------------
Ygraph_nodeEnumeratePop
-------------------------------------------------*/
extern VOID Ygraph_nodeEnumeratePop( P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_nodeEnumeratePush
-------------------------------------------------*/
extern VOID Ygraph_nodeEnumeratePush( P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_nodeMin
-------------------------------------------------*/
extern YNODEPTR Ygraph_nodeMin(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_nodeMax
-------------------------------------------------*/
extern YNODEPTR Ygraph_nodeMax(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_listAdjNodes
-------------------------------------------------*/
extern YNODEPTR Ygraph_listAdjNodes(P2(YNODEPTR node,INT listNum));
/*-------------------------------------------------
Ygraph_listBackNodes
-------------------------------------------------*/
extern YNODEPTR Ygraph_listBackNodes(P2(YNODEPTR node,INT listNum));
/*-------------------------------------------------
Ygraph_nodeInterval
-------------------------------------------------*/
extern YNODEPTR Ygraph_nodeInterval( P4(YGRAPHPTR graph, VOIDPTR loData, VOIDPTR hiData, BOOL startFlag) );
/*-------------------------------------------------
Ygraph_nodeIntervalPush
-------------------------------------------------*/
VOID Ygraph_nodeIntervalPush(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_nodeIntervalPop
-------------------------------------------------*/
VOID Ygraph_nodeIntervalPop(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_edgeInterval
-------------------------------------------------*/
extern YEDGEPTR Ygraph_edgeInterval( P4(YGRAPHPTR graph, VOIDPTR loData, VOIDPTR hiData, BOOL startFlag) );
/*-------------------------------------------------
Ygraph_edgeIntervalPush
-------------------------------------------------*/
VOID Ygraph_edgeIntervalPush(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_edgeIntervalPop
-------------------------------------------------*/
VOID Ygraph_edgeIntervalPop(P1(YGRAPHPTR graph));
/*--------------------------------------------------
free_node: free node from data structure
--------------------------------------------------*/
extern VOID Ygraph_nodeDelete(P4(YGRAPHPTR graph,YNODEPTR node,
VOID (*nodeFree)(),VOID (*edgeFree)()));
/*-------------------------------------------------
Ygraph_nodeVeriy: exercise node data structure
-------------------------------------------------*/
extern int Ygraph_nodeVerify(P1(YNODEPTR node));
/*-------------------------------------------------
Ygraph_edgeVeriy: exercise edge data structure
-------------------------------------------------*/
extern int Ygraph_edgeVerify(P1(YEDGEPTR edge));
/*-------------------------------------------------
Ygraph_copy: returns a copy of a graph
-------------------------------------------------*/
extern YGRAPHPTR Ygraph_copy(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_size()
Returns the graph size field.
The size of the graph is set if the graph is
returned by Ygraph_steiner().
Also, Ygraph_edgeWeights2Size() can be called to
add up all of the edge weights into a single size.
-------------------------------------------------*/
extern INT Ygraph_size( P1 (YGRAPHPTR graph) );
/*-------------------------------------------------
Ygraph_edgeWeights2Size
Sum all of the edge weights, and put into the
graph size field.
-------------------------------------------------*/
extern INT Ygraph_edgeWeights2Size( P1 (YGRAPHPTR graph) );
/*------------------------------------------------------------
Ygraph_bfs()
Perform a beadth first seach rooted at sourceNode.
Optionally, the user can provide a targetNode beyond
which the search is terminated.
------------------------------------------------------------*/
extern VOID Ygraph_bfs(P3(YGRAPHPTR graph,YNODEPTR source,YNODEPTR target));
/*-----------------------------------------------------------
Ygraph_path: returns a deck containing a path
between a source and target.
To use, first run Ygraph_bfs or Ygraph_dijkstra on a graph.
Then, run Ygraph_path. Node target will be traced back to
its source, and the path will be returned in a deck.
NOTE: The path deck is passed to the user and the user
is responsible for freeing it.
-----------------------------------------------------------*/
extern YDECKPTR Ygraph_path(P2(YGRAPHPTR graph,YNODEPTR target));
/*--------------------------------------------------
Ygraph_dfs: Perform a depth first search
--------------------------------------------------*/
extern YDECKPTR Ygraph_dfs(P1(YGRAPHPTR graph));
/*----------------------------------------------------------
Ygraph_mst_Kruskal: Find a mst using Kruskal's algorithm
----------------------------------------------------------*/
extern YDECKPTR Ygraph_mst_kruskal(P1(YGRAPHPTR graph));
/*----------------------------------------------------------
Ygraph_mst_prim: Find a mst using prim's algorithm
----------------------------------------------------------*/
extern YDECKPTR Ygraph_mst_prim(P2(YGRAPHPTR graph,YNODEPTR source));
/*----------------------------------------------------------
Ygraph_mst_dijkstra: Find a shortest paths from source
----------------------------------------------------------*/
extern VOID Ygraph_dijkstra(P2(YGRAPHPTR graph,YNODEPTR source));
/*----------------------------------------------------------
Ygraph_bellman_ford: single source shortest path for
directed edge graph.
Returns TRUE if shortest path found.
Returns FALSE if negative weight cycle exists
----------------------------------------------------------*/
extern BOOL Ygraph_bellman_ford(P2(YGRAPHPTR graph,YNODEPTR source));
/*-------------------------------------------------------
Ygraph_cycles: uses depth first search to find cycles
in a graph. The returned deck contains all cycles.
Each cycle is a deck. Thus, the returned deck contains
decks. The user is responsible for freeing memory.
---------------------------------------------------------*/
extern YDECKPTR Ygraph_cycles(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_clearRequired: clear all nodes which must
part of any steiner tree
-------------------------------------------------*/
extern VOID Ygraph_clearRequired(P1(YGRAPHPTR graph));
/*-------------------------------------------------
Ygraph_nodeRequired: insert a node which must be
part of any steiner tree
-------------------------------------------------*/
extern YNODEPTR Ygraph_nodeRequired(P3(YGRAPHPTR graph,YNODEPTR node,YNODEPTR equiv));
/*-------------------------------------------------
Ygraph_nodeRequiredCount:
Returns the number of nodes in the required node
set.
-------------------------------------------------*/
INT Ygraph_nodeRequiredCount( P1(YGRAPHPTR graph) );
/*-------------------------------------------------
Ygraph_enumerateRequired: enumerates all nodes which
must be part of any steiner tree or required path.
-------------------------------------------------*/
extern YNODEPTR Ygraph_enumerateRequired(P2(YGRAPHPTR graph,BOOL startFlag));
/*------------------------------------------------------------
Ygraph_requiredPath()
Perform a beadth first seach to
find a single path between nodes of different sets.
Use Ygraph_nodeRequired() to set up initial sets.
Use Ygraph_clearRequired() to clear initial sets.
------------------------------------------------------------*/
extern YDECKPTR Ygraph_requiredPath(P1(YGRAPHPTR graph));
/*--------------------------------------------------
Return size of last required path
--------------------------------------------------*/
extern INT Ygraph_requiredPathSize(P1(YGRAPHPTR graph));
/*----------------------------------------------------------
Ygraph_steiner: Find the mst for a set of nodes.
Returns a graph which spans the required nodes.
The returned graph is not guaranteed to be optimal.
A random interchange is performed maxImproves times in
an attempt to reduce the weight of the spanning graph.
The user can use Ygraph_size() to find the total cost
of the returned steiner tree.
----------------------------------------------------------*/
extern YGRAPHPTR Ygraph_steiner(P2(YGRAPHPTR graph,int maxImproves));
/*----------------------------------------
Improves the steiner tree.
The original graph must have its required
nodes properly set.
----------------------------------------*/
VOID Ygraph_steinerImprove(P3(YGRAPHPTR graph,YGRAPHPTR steinerGraph,
int maxIterations));
/*---------------------------------------
Ygraph_copy: copy a graph.
---------------------------------------*/
extern YGRAPHPTR Ygraph_copy( P1(YGRAPHPTR graph) );
/*----------------------------------------------------------
Ygraph_nodeVerify: Verify a nodes data structure
----------------------------------------------------------*/
extern int Ygraph_nodeVerify(P1( YNODEPTR node ));
/*----------------------------------------------------------
Ygraph_verify: exercise graph data structure
----------------------------------------------------------*/
extern int Ygraph_verify(P1(YGRAPHPTR graph));
/*------------------------------------------------------------
Ygraph_dump: print graph stats and call user print functions
------------------------------------------------------------*/
extern VOID Ygraph_dump(P3(YGRAPHPTR graph,VOID (*printNode)(),VOID (*printEdge)()));
/*---------------------------------------------------------
Sets up the users draw functions for Ygraph_draw.
---------------------------------------------------------*/
extern VOID Ygraph_drawFunctions(P3( YGRAPHPTR graph, VOID (*userNodeDraw)(), VOID (*userEdgeDraw)()));
/*---------------------------------------------------------
Get the current edge weight function
---------------------------------------------------------*/
extern INT (*Ygraph_getEdgeWeightFunction(P1(YGRAPHPTR graph)))();
/*---------------------------------------------------------
Set the current edge weight function
---------------------------------------------------------*/
extern VOID Ygraph_setEdgeWeightFunction(P2(YGRAPHPTR graph,
INT (*userEdgeWeight)()));
/*---------------------------------------------------------
Call the users drawing functions for all required nodes
To use this function first call Ygraph_drawFunctions().
The user's node draw function will be passed a node and a color.
The user's edge draw function will be passed an edge and a color.
Some sample edge and node draw function are below:
VOID drawNode(node,color)
YNODEPTR node;
int color;
{
myNodeType n;
n = (myNodeType) Ygraph_nodeData(node);
TW3DdrawLine(0,n->x,n->y,n->z,n->x,n->y,n->z,color,0);
}
VOID drawEdge(edge,color)
YEDGEPTR edge;
int color;
{
myEdgeType e;
e = (myEdgeType) Ygraph_edgeData(edge);
TW3DdrawLine(0,e->x1,e->y1,e->z1,e->x2,e->y2,e->z2,color,0);
}
---------------------------------------------------------*/
extern VOID Ygraph_drawRequired(P1(YGRAPHPTR graph));
/*---------------------------------------------------------
Call the users drawing functions for all primed edges
User must write drawing routines since library has no
way of knowing what node and edge data is.
To use this function first call Ygraph_drawFunctions().
The user's node draw function will be passed a node and a color.
The user's edge draw function will be passed an edge and a color.
Some sample edge and node draw function are below:
VOID drawNode(node,color)
YNODEPTR node;
int color;
{
myNodeType n;
n = (myNodeType) Ygraph_nodeData(node);
TW3DdrawLine(0,n->x,n->y,n->z,n->x,n->y,n->z,color,0);
}
VOID drawEdge(edge,color)
YEDGEPTR edge;
int color;
{
myEdgeType e;
e = (myEdgeType) Ygraph_edgeData(edge);
TW3DdrawLine(0,e->x1,e->y1,e->z1,e->x2,e->y2,e->z2,color,0);
}
---------------------------------------------------------*/
extern VOID Ygraph_drawPrime(P1(YGRAPHPTR graph));
/*---------------------------------------------------------
Call the users drawing functions for all nodes and edges
User must write drawing routines since library has no
way of knowing what node and edge data is.
To use this function first call Ygraph_drawFunctions().
The user's node draw function will be passed a node and a color.
The user's edge draw function will be passed an edge and a color.
Some sample edge and node draw function are below:
VOID drawNode(node,color)
YNODEPTR node;
int color;
{
myNodeType n;
n = (myNodeType) Ygraph_nodeData(node);
TW3DdrawLine(0,n->x,n->y,n->z,n->x,n->y,n->z,color,0);
}
VOID drawEdge(edge,color)
YEDGEPTR edge;
int color;
{
myEdgeType e;
e = (myEdgeType) Ygraph_edgeData(edge);
TW3DdrawLine(0,e->x1,e->y1,e->z1,e->x2,e->y2,e->z2,color,0);
}
---------------------------------------------------------*/
extern VOID Ygraph_draw(P1(YGRAPHPTR graph));
#endif /* YGRAPH_H */
|