Seperating two graphs based on connectivity and coordinates

Posted by martin on Stack Overflow See other posts from Stack Overflow or by martin
Published on 2012-10-25T10:52:43Z Indexed on 2012/10/25 11:00 UTC
Read the original article Hit count: 169

Filed under:
|
|

I would like to separate existing data of vertices and edges into two or more graphs that are not connected. I would like to give the following as example:

Imagine two hexagons on top of each other but are lying in different Z.

Hexagon 1 has the following vertices A(0,0,1), B(1,0,2), C(2,1,2), D(1,2,1), E(0,2,1), F(-1,2,1). The connectivity is as following: A-B, B-C, C-D, D-E, E-F, F-A. This part of Graph 1 as all the vertices are connected in this layer.

Hexagon2 has the following vertices A1(0,0,6), B1(1,0,7), C1(2,1,7), D1(1,2,8), E1(0,2,7), F1(-1,2,6). The connectivity is as following: A1-B1, B1-C1, C1-D1, D1-E1, E1-F1, F1-A1. This is part of Graph 2

My data is in the following form: list of Vertices and list of Edges that i can form graphs with. I would like to eliminate graph 2 and give only vertices and connectivity of graph 1 to polygon determination part of my algorithm. My real data contains around 1000 connected polygons as graph 1 and around 100 (much larger in area) polygons as graph 2. I would like to eliminate graph 2.

I am programming this in python. Thanks in advance.

© Stack Overflow or respective owner

Related posts about python

Related posts about graph