/// <summary> /// /// </summary> /// <returns></returns> public EdgeGraph ExtractEdgeGraph() { if (_model == null) { Initialize(); } var g0 = _tileGraph.Graph; var g1 = new EdgeGraph(g0.VertexCount); for (int v0 = 0; v0 < g0.VertexCount; v0++) { g1.AddVertex(); } var n = _map.TileDegree; for (int v0 = 0; v0 < g0.VertexCount; v0++) { var tile = _model.GetAssigned(v0); if (_applyTileFilter == true && _ignoreTiles.Contains(tile)) { continue; } for (int i = 0; i < n; i++) { var label = _map.GetLabel(i, tile); if (_labelSet.Contains(label)) { int v1 = g0.GetVertexNeighborOut(v0, i); if (v0 != v1) { if (!g1.HasEdge(v1, v0) && !g1.HasEdge(v0, v1)) { g1.AddEdge(v0, v1); } } } } } return(g1); }
public EdgeGraph ExtractJointEdgeGraph() { if (_model == null) { Initialize(); } var g0 = _tileGraph.Graph; var g1 = new EdgeGraph(g0.VertexCount); for (int v0 = 0; v0 < g0.VertexCount; v0++) { g1.AddVertex(); } var n = _map.TileDegree; for (int v0 = 0; v0 < g0.VertexCount; v0++) { var tile = _model.GetAssigned(v0); for (int i = 0; i < n; i++) { var label = _map.GetLabel(i, tile); if (label != "0") { int v1 = g0.GetVertexNeighborOut(v0, i); if (v0 != v1) { if (!g1.HasEdge(v1, v0) && !g1.HasEdge(v0, v1)) { g1.AddEdge(v0, v1); } } } } } return(g1); }