Other Ways to Create Graphs
List of: Discussion Topic
Subjects: Graph Theory
Contents: Kernel

A method has also been added to return a subgraph that is a shortest path between two vertices in the same component of a graph. The shortest path from A to G in Figure 5-18 is the path (A, B, H, F, G).

For cycle vertices, a method has been added to return a subgraph that is a shortest cycle that contains the vertex. The shortest cycle of the graph in Figure 5-18 that contains C is the cycle (C, B, H, D, C).


Figure 5-18. The Connectivity Graph

Figure 5-19 shows a blank body consisting of a block with two slots cut out of it and a tool body consisting of a cylinder that penetrates the block three times.


Figure 5-19. The Blank and Tool Bodies

The first stage of the selective Booleans creates a non-regular unite of the two bodies and attaches cellular topology to the result (Figure 5-20). In addition, the connectivity graph (Figure 5-18) of the resulting cells is returned and the vertices, or cells, of the graph are marked in a way that lets one know which body or bodies they came from.


Figure 5-20. The Blank Body After the First Stage of Selective Booleans

Graphs may be copied by calling the copy method or created for an ENTITY_LIST of CELLs by calling api_create_graph_from_cells. Figure 5-18 is the graph that is created if the eight cells in Figure 5-20 are sent to api_create_graph_from_cells.

The gvertex and gedge classes also have pointers for holding true or false information as to what kind of vertex or edge they are. The meaning of kind is left to the user. A vertex or edge may (or may not) be any number of kinds.

For example, the cells of the body in Figure 5-20 may be marked as kind 0 (meaning being from the tool body) or kind 1 (meaning being from the blank body). Some cells may be of both kind 0 and kind 1.

The kind method of the class generic_graph returns a subgraph of all edges and vertices of, or not of, a given kind. The graph in Figure 5-18 is returned by the first stage of the selective Boolean on the bodies in Figure 5-19. The linear subgraph formed by the vertices (A, B, C, D, E, F, G) are from the tool body and marked as kind 0. The subgraph formed by the vertices (B, H, D, G) are from the blank body and are marked as kind 1.

The second stage of the selective Boolean engine takes the non-regular united body and a list or graph of cells. It returns a regularized body that is made up of the given cells or vertices of the graph (Figure 5-21).


Figure 5-21. The Result of Picking C, G, and H to Keep
PDF/KERN/05GRAPH.PDF
HTM/DATA/KERN/KERN/05GRAPH/0006.HTM