-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathcPMFG_Graph.cls
138 lines (107 loc) · 3.27 KB
/
cPMFG_Graph.cls
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
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "cPMFG_Graph"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private pN_Nodes As Long
Private pM_Edges As Long
Private pG() As cPMFG_Node
Private pVertices() As cPMFG_VertexRec
Private pBicompLists As cPMFG_ListColl
Private pDFSChildLists As cPMFG_ListColl
Private ptheStack As cPMFG_Stack
Private pbuckets() As Long
Private pbin As cPMFG_ListColl
Private pextFace() As cPMFG_extFaceLinkRec
Private pinternalFlags As Long
'FLAGS_DFSNUMBERED 1
'FLAGS_SORTEDBYDFI 2
Sub InitGraph(n As Long)
Dim i As Long, v As cPMFG_Node, vRec As cPMFG_VertexRec, vextFace As cPMFG_extFaceLinkRec
pN_Nodes = n
ReDim pG(0 To (2 * n - 1 + n * (n - 1)))
For i = 0 To (2 * n - 1 + n * (n - 1))
Set v = New cPMFG_Node
v.InitGraphNode
Set pG(i) = v
Next i
ReDim pVertices(0 To n - 1)
For i = 0 To (n - 1)
Set vRec = New cPMFG_VertexRec
vRec.InitVertexRec (i)
Set pVertices(i) = vRec
Next i
ReDim pextFace(0 To 2 * n - 1)
For i = 0 To 2 * n - 1
Set vextFace = New cPMFG_extFaceLinkRec
vextFace.Link(0) = -1
vextFace.Link(1) = -1
vextFace.inversionFlag = 0
Set pextFace(i) = vextFace
Next i
Set pbin = New cPMFG_ListColl
Set pDFSChildLists = New cPMFG_ListColl
Set pBicompLists = New cPMFG_ListColl
pbin.LCNew (n)
pDFSChildLists.LCNew (n)
pBicompLists.LCNew (n)
ReDim pbuckets(0 To n - 1)
Set ptheStack = New cPMFG_Stack
ptheStack.NewStack (n * (n - 1))
ptheStack.NewStack (n * (n - 1))
pinternalFlags = 0
End Sub
Public Property Get N_Nodes() As Long
N_Nodes = pN_Nodes
End Property
Public Property Let N_Nodes(lN_Nodes As Long)
pN_Nodes = lN_Nodes
End Property
Public Property Get M_Edges() As Long
M_Edges = pM_Edges
End Property
Public Property Let M_Edges(lM_Edges As Long)
pM_Edges = lM_Edges
End Property
Public Property Get g(i As Long) As cPMFG_Node
Set g = pG(i)
End Property
Public Property Set g(i As Long, j As cPMFG_Node)
Set pG(i) = j
End Property
Public Property Get Vertices(i As Long) As cPMFG_VertexRec
Set Vertices = pVertices(i)
End Property
Public Property Set Vertices(i As Long, j As cPMFG_VertexRec)
Set pVertices(i) = j
End Property
Public Property Get bin() As cPMFG_ListColl
Set bin = pbin
End Property
Public Property Get DFSChildLists() As cPMFG_ListColl
Set DFSChildLists = pDFSChildLists
End Property
Public Property Get BicompLists() As cPMFG_ListColl
Set BicompLists = pBicompLists
End Property
Public Property Get extFace(i As Long) As cPMFG_extFaceLinkRec
Set extFace = pextFace(i)
End Property
Public Property Set extFace(i As Long, j As cPMFG_extFaceLinkRec)
Set pextFace(i) = j
End Property
Public Property Get internalFlags() As Long
internalFlags = pinternalFlags
End Property
Public Property Let internalFlags(linternalFlags As Long)
pinternalFlags = linternalFlags
End Property
Public Property Get Stack() As cPMFG_Stack
Set Stack = New cPMFG_Stack
Set Stack = ptheStack
End Property