mbunit2 2.4.2.355.20100801
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/docs/ASL - Apache Software Foundation License.txt +57 -0
- data/docs/MbUnit License.txt +14 -0
- data/docs/MbUnit.chm +0 -0
- data/docs/Release Notes.txt +7 -0
- data/docs/extras/CCNet/How to use MbUnit v2 with CruiseControl.Net.txt +88 -0
- data/docs/extras/CCNet/images/Category.png +0 -0
- data/docs/extras/CCNet/images/Fixture.png +0 -0
- data/docs/extras/CCNet/images/Populator.png +0 -0
- data/docs/extras/CCNet/images/Test.png +0 -0
- data/docs/extras/CCNet/xsl/MBUnitDetails.xsl +592 -0
- data/docs/extras/CCNet/xsl/MBUnitSummary.xsl +266 -0
- data/docs/extras/Snippets/AdjacencyGraph.cst +1703 -0
- data/docs/extras/Snippets/AssertWrapper.cst +181 -0
- data/docs/extras/Snippets/CrudPopulator.cst +377 -0
- data/docs/extras/Snippets/DatabasePopulator.cst +386 -0
- data/docs/extras/Snippets/DatabasePopulatorCrudTest.cst +177 -0
- data/docs/extras/Snippets/Exception.cst +94 -0
- data/docs/extras/Snippets/GrammarPopulator.cst +258 -0
- data/docs/extras/Snippets/MockObject.cst +296 -0
- data/docs/extras/Snippets/RapTierCrudPopulator.cst +444 -0
- data/docs/extras/Snippets/SimpleFixture.cst +91 -0
- data/docs/extras/Snippets/SqlppCrudPopulator.cst +443 -0
- data/docs/extras/Snippets/TestFixture.cst +469 -0
- data/docs/extras/Snippets/autorunner.snippet +45 -0
- data/docs/extras/Snippets/combinatorialtest.snippet +54 -0
- data/docs/extras/Snippets/datafixture.snippet +61 -0
- data/docs/extras/Snippets/model.snippet +95 -0
- data/docs/extras/Snippets/msbuild.snippet +40 -0
- data/docs/extras/Snippets/nant.snippet +34 -0
- data/docs/extras/Snippets/perfcounterassert.cst +173 -0
- data/docs/extras/Snippets/processtestfixture.snippet +75 -0
- data/docs/extras/Snippets/rowtest.snippet +113 -0
- data/docs/extras/Snippets/state.snippet +27 -0
- data/docs/extras/Snippets/submodel.snippet +32 -0
- data/docs/extras/Snippets/test.snippet +28 -0
- data/docs/extras/Snippets/testexpectedexception.snippet +32 -0
- data/docs/extras/Snippets/testfixture.snippet +68 -0
- data/docs/extras/Snippets/testsuitefixture.snippet +48 -0
- data/docs/extras/Snippets/typefixture.snippet +74 -0
- data/docs/extras/Snippets/typefixturewithproviderfactory.snippet +77 -0
- data/docs/extras/Snippets/usingmbunit.snippet +19 -0
- data/docs/extras/Templates/VS2005/ItemTemplates/CSharp/Test/MbUnit2.TestFixtureTemplate.CSharp.zip +0 -0
- data/docs/extras/Templates/VS2005/ItemTemplates/VisualBasic/Test/MbUnit2.TestFixtureTemplate.VisualBasic.zip +0 -0
- data/docs/extras/Templates/VS2005/ProjectTemplates/CSharp/Test/MbUnit2.TestProjectTemplate.CSharp.zip +0 -0
- data/docs/extras/Templates/VS2005/ProjectTemplates/VisualBasic/Test/MbUnit2.TestProjectTemplate.VisualBasic.zip +0 -0
- data/docs/extras/Templates/VS2008/ItemTemplates/CSharp/Test/MbUnit2.TestFixtureTemplate.CSharp.zip +0 -0
- data/docs/extras/Templates/VS2008/ItemTemplates/VisualBasic/Test/MbUnit2.TestFixtureTemplate.VisualBasic.zip +0 -0
- data/docs/extras/Templates/VS2008/ProjectTemplates/CSharp/Test/MbUnit2.MvcWebApplicationTestProjectTemplate.CSharp.zip +0 -0
- data/docs/extras/Templates/VS2008/ProjectTemplates/CSharp/Test/MbUnit2.TestProjectTemplate.CSharp.zip +0 -0
- data/docs/extras/Templates/VS2008/ProjectTemplates/VisualBasic/Test/MbUnit2.MvcWebApplicationTestProjectTemplate.VisualBasic.zip +0 -0
- data/docs/extras/Templates/VS2008/ProjectTemplates/VisualBasic/Test/MbUnit2.TestProjectTemplate.VisualBasic.zip +0 -0
- data/lib/MbUnit License.txt +14 -0
- data/lib/MbUnit.AddIn.dll +0 -0
- data/lib/MbUnit.Cons.exe +0 -0
- data/lib/MbUnit.Cons.exe.config +12 -0
- data/lib/MbUnit.Framework.2.0.dll +0 -0
- data/lib/MbUnit.Framework.2.0.pdb +0 -0
- data/lib/MbUnit.Framework.2.0.xml +278 -0
- data/lib/MbUnit.Framework.dll +0 -0
- data/lib/MbUnit.Framework.pdb +0 -0
- data/lib/MbUnit.Framework.xml +6929 -0
- data/lib/MbUnit.GUI.exe +0 -0
- data/lib/MbUnit.GUI.exe.config +14 -0
- data/lib/MbUnit.MSBuild.Tasks.dll +0 -0
- data/lib/MbUnit.Tasks.dll +0 -0
- data/lib/NGraphviz.Helpers.dll +0 -0
- data/lib/NGraphviz.Layout.dll +0 -0
- data/lib/NGraphviz.dll +0 -0
- data/lib/QuickGraph.Algorithms.Graphviz.dll +0 -0
- data/lib/QuickGraph.Algorithms.dll +0 -0
- data/lib/QuickGraph.Algorithms.pdb +0 -0
- data/lib/QuickGraph.Algorithms.xml +2818 -0
- data/lib/QuickGraph.dll +0 -0
- data/lib/QuickGraph.pdb +0 -0
- data/lib/QuickGraph.xml +3126 -0
- data/lib/Refly.dll +0 -0
- data/lib/Refly.pdb +0 -0
- data/lib/Refly.xml +1327 -0
- data/lib/TestFu.dll +0 -0
- data/lib/TestFu.pdb +0 -0
- data/lib/TestFu.xml +1932 -0
- data/lib/XsdTidy.exe +0 -0
- metadata +163 -0
@@ -0,0 +1,266 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<xsl:stylesheet
|
3
|
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
4
|
+
|
5
|
+
<xsl:output method="html"/>
|
6
|
+
|
7
|
+
<xsl:variable name="nunit2.result.list" select="//report-result/counter"/>
|
8
|
+
<xsl:variable name="nunit2.testcount" select="sum($nunit2.result.list/@run-count)"/>
|
9
|
+
<xsl:variable name="nunit2.failures" select="sum($nunit2.result.list/@failure-count)"/>
|
10
|
+
<xsl:variable name="nunit2.notrun" select="sum($nunit2.result.list/@skip-count)"/>
|
11
|
+
<xsl:variable name="nunit2.time" select="sum($nunit2.result.list/@duration)"/>
|
12
|
+
<xsl:variable name="nunit2.case.list" select="//report-result/assemblies/assembly/namespaces/namespace/fixtures/fixture"/>
|
13
|
+
<xsl:variable name="nunit2.suite.list" select="//report-result/assemblies/assembly/namespaces/namespace/fixtures/fixture/runs/run"/>
|
14
|
+
<xsl:variable name="nunit2.failure.list" select="//report-result/assemblies/assembly/namespaces/namespace/fixtures/fixture/runs/run/exception"/>
|
15
|
+
<xsl:variable name="nunit2.notrun.list" select="$nunit2.case.list//reason"/>
|
16
|
+
|
17
|
+
<xsl:variable name="testsuite.list" select="/cruisecontrol/build/buildresults//testsuite"/>
|
18
|
+
<xsl:variable name="testcase.list" select="$testsuite.list/testcase"/>
|
19
|
+
<xsl:variable name="testcase.error.list" select="$testcase.list/error"/>
|
20
|
+
<xsl:variable name="testsuite.error.count" select="count($testcase.error.list)"/>
|
21
|
+
<xsl:variable name="testcase.failure.list" select="$testcase.list/failure"/>
|
22
|
+
<!--<xsl:variable name="totalErrorsAndFailures" select="count($testcase.error.list) + count($testcase.failure.list) + count($nunit2.failure.list)"/>-->
|
23
|
+
<xsl:variable name="totalErrorsAndFailures" select="sum($nunit2.result.list/@failure-count)"/>
|
24
|
+
|
25
|
+
<xsl:template match="/">
|
26
|
+
<xsl:if test="//report-result">
|
27
|
+
<xsl:apply-templates select="/" mode="emit" />
|
28
|
+
</xsl:if>
|
29
|
+
</xsl:template>
|
30
|
+
|
31
|
+
<xsl:template match="/" mode="emit">
|
32
|
+
<table class="section-table" cellpadding="2" cellspacing="0" border="0" width="98%">
|
33
|
+
|
34
|
+
<!-- Unit Tests -->
|
35
|
+
<tr>
|
36
|
+
<td class="unittests-sectionheader" colspan="2">
|
37
|
+
Tests run: <xsl:value-of select="$nunit2.testcount"/>, Failures: <xsl:value-of select="$nunit2.failures"/>, Not run: <xsl:value-of select="$nunit2.notrun"/>, Time: <xsl:value-of select="$nunit2.time"/> seconds
|
38
|
+
</td>
|
39
|
+
</tr>
|
40
|
+
|
41
|
+
<xsl:choose>
|
42
|
+
<xsl:when test="$nunit2.testcount = 0">
|
43
|
+
<tr><td colspan="2" class="unittests-data">No Tests Run</td></tr>
|
44
|
+
<tr><td colspan="2" class="unittests-error">This project doesn't have any tests</td></tr>
|
45
|
+
</xsl:when>
|
46
|
+
|
47
|
+
<xsl:when test="$totalErrorsAndFailures = 0">
|
48
|
+
<tr><td colspan="2" class="unittests-data">All Tests Passed</td></tr>
|
49
|
+
</xsl:when>
|
50
|
+
</xsl:choose>
|
51
|
+
|
52
|
+
<!--<xsl:apply-templates select="$testcase.error.list"/>
|
53
|
+
<xsl:apply-templates select="$testcase.failure.list | $nunit2.failure.list"/>
|
54
|
+
<xsl:apply-templates select="$nunit2.notrun.list"/>-->
|
55
|
+
|
56
|
+
<tr><td colspan="2"> </td></tr>
|
57
|
+
|
58
|
+
<xsl:if test="$totalErrorsAndFailures > 0">
|
59
|
+
<tr>
|
60
|
+
<td class="unittests-sectionheader" colspan="2">
|
61
|
+
Unit Test Failure and Error Details (<xsl:value-of select="$totalErrorsAndFailures"/>)
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<!--<xsl:call-template name="nunit2testdetail">
|
66
|
+
<xsl:with-param name="detailnodes" select="$nunit2.suite.list"/>
|
67
|
+
</xsl:call-template>-->
|
68
|
+
|
69
|
+
<xsl:call-template name="nunit2testdetail">
|
70
|
+
<xsl:with-param name="detailnodes" select="//report-result/assemblies/assembly//namespaces//namespace/fixtures/fixture/runs/run"/>
|
71
|
+
</xsl:call-template>
|
72
|
+
|
73
|
+
|
74
|
+
<tr><td colspan="2"> </td></tr>
|
75
|
+
</xsl:if>
|
76
|
+
|
77
|
+
<xsl:if test="$nunit2.notrun > 0">
|
78
|
+
<tr>
|
79
|
+
<td class="unittests-sectionheader" colspan="2">
|
80
|
+
Warning Details (<xsl:value-of select="$nunit2.notrun"/>)
|
81
|
+
</td>
|
82
|
+
</tr>
|
83
|
+
<!-- (PENDING) Why doesn't this work if set up as variables up top? -->
|
84
|
+
<xsl:call-template name="nunit2testdetail">
|
85
|
+
<xsl:with-param name="detailnodes" select="//test-suite/results/test-case[.//reason]"/>
|
86
|
+
</xsl:call-template>
|
87
|
+
<tr><td colspan="2"> </td></tr>
|
88
|
+
</xsl:if>
|
89
|
+
</table>
|
90
|
+
</xsl:template>
|
91
|
+
|
92
|
+
<!-- UnitTest Errors -->
|
93
|
+
<xsl:template match="error">
|
94
|
+
<tr>
|
95
|
+
<xsl:if test="position() mod 2 = 0">
|
96
|
+
<xsl:attribute name="class">unittests-oddrow</xsl:attribute>
|
97
|
+
</xsl:if>
|
98
|
+
<td class="unittests-data">Error</td>
|
99
|
+
<td class="unittests-data"><xsl:value-of select="../@name"/></td>
|
100
|
+
</tr>
|
101
|
+
</xsl:template>
|
102
|
+
|
103
|
+
<!-- UnitTest Failures -->
|
104
|
+
<xsl:template match="failure">
|
105
|
+
<tr>
|
106
|
+
<xsl:if test="($testsuite.error.count + position()) mod 2 = 0">
|
107
|
+
<xsl:attribute name="class">unittests-oddrow</xsl:attribute>
|
108
|
+
</xsl:if>
|
109
|
+
<td class="unittests-data">Failure</td>
|
110
|
+
<td class="unittests-data"><xsl:value-of select="/source"/></td>
|
111
|
+
</tr>
|
112
|
+
</xsl:template>
|
113
|
+
|
114
|
+
<!-- UnitTest Warnings -->
|
115
|
+
<xsl:template match="reason">
|
116
|
+
<tr>
|
117
|
+
<xsl:if test="($totalErrorsAndFailures + position()) mod 2 = 0">
|
118
|
+
<xsl:attribute name="class">unittests-oddrow</xsl:attribute>
|
119
|
+
</xsl:if>
|
120
|
+
<td class="unittests-data">Warning</td>
|
121
|
+
<td class="unittests-data"><xsl:value-of select="../@name"/></td>
|
122
|
+
</tr>
|
123
|
+
</xsl:template>
|
124
|
+
|
125
|
+
<!-- UnitTest Errors And Failures Detail Template -->
|
126
|
+
<xsl:template name="testdetail">
|
127
|
+
<xsl:param name="detailnodes"/>
|
128
|
+
|
129
|
+
<xsl:for-each select="$detailnodes">
|
130
|
+
|
131
|
+
<xsl:if test="position() > 1">
|
132
|
+
<tr><td colspan="2"><hr size="1" width="100%" color="#888888"/></td></tr>
|
133
|
+
</xsl:if>
|
134
|
+
|
135
|
+
<tr><td class="unittests-data">Test:</td><td class="unittests-data"><xsl:value-of select="@name"/></td></tr>
|
136
|
+
|
137
|
+
<xsl:if test="error">
|
138
|
+
<tr><td class="unittests-data">Type:</td><td class="unittests-data"><xsl:value-of select="error/@type"/></td></tr>
|
139
|
+
<tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="error/@message"/></td></tr>
|
140
|
+
<tr>
|
141
|
+
<td></td>
|
142
|
+
<td class="unittests-error">
|
143
|
+
<pre><xsl:call-template name="br-replace">
|
144
|
+
<xsl:with-param name="word" select="error"/>
|
145
|
+
</xsl:call-template></pre>
|
146
|
+
</td>
|
147
|
+
</tr>
|
148
|
+
</xsl:if>
|
149
|
+
|
150
|
+
<xsl:if test="failure">
|
151
|
+
<tr><td class="unittests-data">Type:</td><td class="unittests-data"><xsl:value-of select="failure/@type"/></td></tr>
|
152
|
+
<tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="failure/@message"/></td></tr>
|
153
|
+
<tr>
|
154
|
+
<td></td>
|
155
|
+
<td class="unittests-error">
|
156
|
+
<pre><xsl:call-template name="br-replace">
|
157
|
+
<xsl:with-param name="word" select="failure"/>
|
158
|
+
</xsl:call-template></pre>
|
159
|
+
</td>
|
160
|
+
</tr>
|
161
|
+
</xsl:if>
|
162
|
+
|
163
|
+
</xsl:for-each>
|
164
|
+
</xsl:template>
|
165
|
+
|
166
|
+
<!-- UnitTest Errors And Failures Detail Template -->
|
167
|
+
<xsl:template name="nunit2testdetail">
|
168
|
+
<xsl:param name="detailnodes"/>
|
169
|
+
|
170
|
+
<xsl:for-each select="$detailnodes">
|
171
|
+
|
172
|
+
<!--<xsl:if test="position() > 1">-->
|
173
|
+
|
174
|
+
<!--</xsl:if>-->
|
175
|
+
|
176
|
+
<xsl:if test="exception">
|
177
|
+
<tr><td colspan="2"><hr size="1" width="100%" color="#888888"/></td></tr>
|
178
|
+
<tr><td class="unittests-data">Test:</td><td class="unittests-data"><xsl:value-of select="@name"/></td></tr>
|
179
|
+
<tr><td class="unittests-data">Type:</td><td class="unittests-data">Failure</td></tr>
|
180
|
+
<tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="exception/message"/></td></tr>
|
181
|
+
<tr>
|
182
|
+
<td></td>
|
183
|
+
<td class="unittests-error">
|
184
|
+
<pre><xsl:value-of select="exception/stack-trace"/></pre>
|
185
|
+
</td>
|
186
|
+
</tr>
|
187
|
+
</xsl:if>
|
188
|
+
|
189
|
+
<xsl:if test="reason">
|
190
|
+
<tr><td class="unittests-data">Test:</td><td class="unittests-data"><xsl:value-of select="@name"/></td></tr>
|
191
|
+
<tr><td class="unittests-data">Type:</td><td class="unittests-data">Warning</td></tr>
|
192
|
+
<tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="reason//message"/></td></tr>
|
193
|
+
<tr>
|
194
|
+
<td></td>
|
195
|
+
<td class="unittests-error">
|
196
|
+
<pre><xsl:call-template name="br-replace">
|
197
|
+
<xsl:with-param name="word" select="/stack-trace"/>
|
198
|
+
</xsl:call-template></pre>
|
199
|
+
</td>
|
200
|
+
</tr>
|
201
|
+
</xsl:if>
|
202
|
+
|
203
|
+
</xsl:for-each>
|
204
|
+
</xsl:template>
|
205
|
+
|
206
|
+
<!-- UnitTest Errors And Failures Detail Template -->
|
207
|
+
<xsl:template name="nunit2testdetail2">
|
208
|
+
<xsl:param name="detailnodes"/>
|
209
|
+
|
210
|
+
<xsl:for-each select="$detailnodes">
|
211
|
+
|
212
|
+
<!--<xsl:if test="position() > 1">-->
|
213
|
+
|
214
|
+
<!--</xsl:if>-->
|
215
|
+
|
216
|
+
<xsl:if test="exception">
|
217
|
+
<tr><td colspan="2"><hr size="1" width="100%" color="#888888"/></td></tr>
|
218
|
+
<tr><td class="unittests-data">Test:</td><td class="unittests-data"><xsl:value-of select="@name"/></td></tr>
|
219
|
+
<tr><td class="unittests-data">Type:</td><td class="unittests-data">Failure</td></tr>
|
220
|
+
<tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="exception/message"/></td></tr>
|
221
|
+
<tr>
|
222
|
+
<td></td>
|
223
|
+
<td class="unittests-error">
|
224
|
+
<pre><xsl:value-of select="exception/stack-trace"/></pre>
|
225
|
+
</td>
|
226
|
+
</tr>
|
227
|
+
</xsl:if>
|
228
|
+
|
229
|
+
<xsl:if test="reason">
|
230
|
+
<tr><td class="unittests-data">Test:</td><td class="unittests-data"><xsl:value-of select="@name"/></td></tr>
|
231
|
+
<tr><td class="unittests-data">Type:</td><td class="unittests-data">Warning</td></tr>
|
232
|
+
<tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="reason//message"/></td></tr>
|
233
|
+
<tr>
|
234
|
+
<td></td>
|
235
|
+
<td class="unittests-error">
|
236
|
+
<pre><xsl:call-template name="br-replace">
|
237
|
+
<xsl:with-param name="word" select="/stack-trace"/>
|
238
|
+
</xsl:call-template></pre>
|
239
|
+
</td>
|
240
|
+
</tr>
|
241
|
+
</xsl:if>
|
242
|
+
|
243
|
+
</xsl:for-each>
|
244
|
+
</xsl:template>
|
245
|
+
|
246
|
+
<xsl:template name="br-replace">
|
247
|
+
<xsl:param name="word"/>
|
248
|
+
<xsl:variable name="cr"><xsl:text>
|
249
|
+
<!-- </xsl:text> on next line on purpose to get newline -->
|
250
|
+
</xsl:text></xsl:variable>
|
251
|
+
<xsl:choose>
|
252
|
+
<xsl:when test="contains($word,$cr)">
|
253
|
+
<xsl:value-of select="substring-before($word,$cr)"/>
|
254
|
+
<br/>
|
255
|
+
<xsl:call-template name="br-replace">
|
256
|
+
<xsl:with-param name="word" select="substring-after($word,$cr)"/>
|
257
|
+
</xsl:call-template>
|
258
|
+
</xsl:when>
|
259
|
+
<xsl:otherwise>
|
260
|
+
<xsl:value-of select="$word"/>
|
261
|
+
</xsl:otherwise>
|
262
|
+
</xsl:choose>
|
263
|
+
</xsl:template>
|
264
|
+
|
265
|
+
</xsl:stylesheet>
|
266
|
+
|
@@ -0,0 +1,1703 @@
|
|
1
|
+
<%@ CodeTemplate Language="C#" TargetLanguage="Text" Description="Template description here." %>
|
2
|
+
<%@ Property Name="VertexType" Type="System.String" Category="Graph" Description="Vertex Type." Optional="False" %>
|
3
|
+
<%@ Property Name="EdgeType" Type="System.String" Category="Graph" Description="Edge Type." Optional="False" %>
|
4
|
+
<%@ Property Name="ClassName" Type="System.String" Category="Options" Description="Class Name." Optional="False" %>
|
5
|
+
<%@ Property Name="TargetNamespace" Type="System.String" Category="Namespaces" Description="Class namespace" %>
|
6
|
+
<%@ Property Name="DefaultConstructor" Type="System.Boolean" Category="Options" Description="Generates default constructor" Optional="True" Default="True" %>
|
7
|
+
<%@ Property Name="EdgeCollectionBaseType" Type="System.String" Category="Graph" Description="Base type of collection used to store edges" Optional="False" Default="CollectionBase" %>
|
8
|
+
<%@ Property Name="VertexEdgesDictionaryBaseType" Type="System.String" Category="Graph" Description="Base type of vertex-edge collection dictionary" Optional="False" Default="DictionaryBase" %>
|
9
|
+
<%@ Property Name="Bidirectional" Type="System.Boolean" Category="Graph" Description="Adjacency graph or bi-directional graph" Optional="False" Default="False" %>
|
10
|
+
<%@ Property Name="IndexedEdges" Type="System.Boolean" Category="Graph" Description="Edges accessible by index" Optional="False" Default="True" %>
|
11
|
+
|
12
|
+
// Automatically generated code, dot edit!
|
13
|
+
|
14
|
+
namespace <%= TargetNamespace %>
|
15
|
+
{
|
16
|
+
using System;
|
17
|
+
using System.Collections;
|
18
|
+
using System.Diagnostics;
|
19
|
+
|
20
|
+
using QuickGraph.Concepts;
|
21
|
+
using QuickGraph.Concepts.Traversals;
|
22
|
+
using QuickGraph.Concepts.Modifications;
|
23
|
+
using QuickGraph.Concepts.MutableTraversals;
|
24
|
+
using QuickGraph.Concepts.Predicates;
|
25
|
+
using QuickGraph.Concepts.Providers;
|
26
|
+
using QuickGraph.Concepts.Collections;
|
27
|
+
using QuickGraph.Concepts.Serialization;
|
28
|
+
using QuickGraph.Collections;
|
29
|
+
using QuickGraph.Exceptions;
|
30
|
+
using QuickGraph.Predicates;
|
31
|
+
|
32
|
+
/// <summary>
|
33
|
+
/// A mutable <% if (Bidirectional){%> bidirectional <%}%>
|
34
|
+
/// incidence graph implemetation of <%= VertexTypeSee %> and
|
35
|
+
/// <%= EdgeTypeSee %>.
|
36
|
+
/// </summary>
|
37
|
+
public class <%= ClassName %> :
|
38
|
+
IMutableGraph
|
39
|
+
,IFilteredVertexAndEdgeListGraph
|
40
|
+
,IFilteredIncidenceGraph
|
41
|
+
,IMutableEdgeListGraph
|
42
|
+
,IEdgeMutableGraph
|
43
|
+
,IMutableIncidenceGraph
|
44
|
+
,IEdgeListAndIncidenceGraph
|
45
|
+
,ISerializableVertexAndEdgeListGraph
|
46
|
+
,IMutableVertexAndEdgeListGraph
|
47
|
+
,IAdjacencyGraph
|
48
|
+
,IImplicitGraph
|
49
|
+
<% if (IndexedEdges) {%>
|
50
|
+
,IIndexedVertexListGraph
|
51
|
+
<%}%>
|
52
|
+
<% if (Bidirectional){%>
|
53
|
+
,IFilteredBidirectionalGraph
|
54
|
+
,IMutableBidirectionalGraph
|
55
|
+
,IBidirectionalVertexAndEdgeListGraph
|
56
|
+
,IMutableBidirectionalVertexAndEdgeListGraph
|
57
|
+
<%}%>
|
58
|
+
{
|
59
|
+
private int version=0;
|
60
|
+
private bool allowParallelEdges;
|
61
|
+
private <%= VertexProviderType %> vertexProvider;
|
62
|
+
private <%= EdgeProviderType %> edgeProvider;
|
63
|
+
private <%= VertexEdgesDictionaryType %> vertexOutEdges = new <%= VertexEdgesDictionaryType %>();
|
64
|
+
<%if (Bidirectional) {%>
|
65
|
+
private <%= VertexEdgesDictionaryType %> vertexInEdges = new <%= VertexEdgesDictionaryType %>();
|
66
|
+
<%}%>
|
67
|
+
|
68
|
+
#region Constructors
|
69
|
+
<% if (DefaultConstructor){%>
|
70
|
+
/// <summary>
|
71
|
+
/// Builds a new empty directed graph with default vertex and edge
|
72
|
+
/// provider.
|
73
|
+
/// </summary>
|
74
|
+
/// <remarks>
|
75
|
+
/// </remarks>
|
76
|
+
public <%= ClassName %>()
|
77
|
+
:this(
|
78
|
+
new <%= VertexProviderType %>(),
|
79
|
+
new <%= EdgeProviderType %>(),
|
80
|
+
true
|
81
|
+
)
|
82
|
+
{}
|
83
|
+
|
84
|
+
/// <summary>
|
85
|
+
/// Builds a new empty directed graph with default vertex and edge
|
86
|
+
/// provider.
|
87
|
+
/// </summary>
|
88
|
+
/// <param name="allowParallelEdges">true if parallel edges are allowed</param>
|
89
|
+
public <%= ClassName %>(bool allowParallelEdges)
|
90
|
+
:this(
|
91
|
+
new <%= VertexProviderType %>(),
|
92
|
+
new <%= EdgeProviderType %>(),
|
93
|
+
allowParallelEdges
|
94
|
+
)
|
95
|
+
{}
|
96
|
+
<%}%>
|
97
|
+
|
98
|
+
/// <summary>
|
99
|
+
/// Builds a new empty directed graph with custom providers
|
100
|
+
/// </summary>
|
101
|
+
/// <param name="allowParallelEdges">true if the graph allows
|
102
|
+
/// multiple edges</param>
|
103
|
+
/// <param name="edgeProvider">custom edge provider</param>
|
104
|
+
/// <param name="vertexProvider">custom vertex provider</param>
|
105
|
+
/// <exception cref="ArgumentNullException">
|
106
|
+
/// vertexProvider or edgeProvider is a null reference (Nothing in Visual Basic)
|
107
|
+
/// </exception>
|
108
|
+
public <%= ClassName %>(
|
109
|
+
<%= VertexProviderType %> vertexProvider,
|
110
|
+
<%= EdgeProviderType %> edgeProvider,
|
111
|
+
bool allowParallelEdges
|
112
|
+
)
|
113
|
+
{
|
114
|
+
if (vertexProvider == null)
|
115
|
+
throw new ArgumentNullException("vertexProvider");
|
116
|
+
if (edgeProvider == null)
|
117
|
+
throw new ArgumentNullException("edgeProvider");
|
118
|
+
|
119
|
+
this.vertexProvider = vertexProvider;
|
120
|
+
this.edgeProvider = edgeProvider;
|
121
|
+
this.allowParallelEdges = allowParallelEdges;
|
122
|
+
}
|
123
|
+
#endregion
|
124
|
+
|
125
|
+
#region IMutableGraph
|
126
|
+
/// <summary>
|
127
|
+
/// Remove all of the edges and vertices from the graph.
|
128
|
+
/// </summary>
|
129
|
+
public virtual void Clear()
|
130
|
+
{
|
131
|
+
this.version++;
|
132
|
+
this.vertexOutEdges.Clear();
|
133
|
+
<% if (Bidirectional){%>
|
134
|
+
this.vertexInEdges.Clear();
|
135
|
+
<%}%>
|
136
|
+
}
|
137
|
+
#endregion
|
138
|
+
|
139
|
+
#region IGraph
|
140
|
+
/// <summary>
|
141
|
+
/// Gets a value indicating if the <%= ClassNameSee %>
|
142
|
+
/// is directed.
|
143
|
+
/// </summary>
|
144
|
+
/// <value>
|
145
|
+
/// true if the graph is directed, false if undirected.
|
146
|
+
/// </value>
|
147
|
+
public bool IsDirected
|
148
|
+
{
|
149
|
+
get
|
150
|
+
{
|
151
|
+
return true;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
/// <summary>
|
156
|
+
/// Gets a value indicating if the <%= ClassNameSee %> allows parallel edges.
|
157
|
+
/// </summary>
|
158
|
+
/// <value>
|
159
|
+
/// true if the <%= ClassNameSee %> is a multi-graph, false otherwise
|
160
|
+
/// </value>
|
161
|
+
public bool AllowParallelEdges
|
162
|
+
{
|
163
|
+
get
|
164
|
+
{
|
165
|
+
return this.IsDirected && this.allowParallelEdges;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
#endregion
|
169
|
+
|
170
|
+
#region IVertexMutableGraph
|
171
|
+
/// <summary>
|
172
|
+
/// Gets the <%= VertexTypeSee %> provider
|
173
|
+
/// </summary>
|
174
|
+
/// <value>
|
175
|
+
/// <%= VertexTypeSee %> provider
|
176
|
+
/// </value>
|
177
|
+
public <%= VertexProviderType %> VertexProvider
|
178
|
+
{
|
179
|
+
get
|
180
|
+
{
|
181
|
+
return this.vertexProvider;
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
IVertexProvider IVertexMutableGraph.VertexProvider
|
186
|
+
{
|
187
|
+
get
|
188
|
+
{
|
189
|
+
return this.VertexProvider;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
/// <summary>
|
194
|
+
/// Add a new <%= VertexType %> to the graph and returns it.
|
195
|
+
/// </summary>
|
196
|
+
/// <returns>
|
197
|
+
/// Created vertex
|
198
|
+
/// </returns>
|
199
|
+
public virtual <%= VertexType %> AddVertex()
|
200
|
+
{
|
201
|
+
this.version++;
|
202
|
+
<%= VertexType %> v = (<%= VertexType %>)this.VertexProvider.ProvideVertex();
|
203
|
+
this.vertexOutEdges.Add(v);
|
204
|
+
<% if (Bidirectional) {%>
|
205
|
+
this.vertexInEdges.Add(v);
|
206
|
+
<%}%>
|
207
|
+
|
208
|
+
return v;
|
209
|
+
}
|
210
|
+
|
211
|
+
IVertex IVertexMutableGraph.AddVertex()
|
212
|
+
{
|
213
|
+
return this.AddVertex();
|
214
|
+
}
|
215
|
+
|
216
|
+
/// <summary>
|
217
|
+
/// Removes the vertex from the graph.
|
218
|
+
/// </summary>
|
219
|
+
/// <param name="v">vertex to remove</param>
|
220
|
+
/// <exception cref="ArgumentNullException">v is null</exception>
|
221
|
+
public virtual void RemoveVertex(<%= VertexType %> v)
|
222
|
+
{
|
223
|
+
if (v == null)
|
224
|
+
throw new ArgumentNullException("v");
|
225
|
+
if (!ContainsVertex(v))
|
226
|
+
throw new VertexNotFoundException("v");
|
227
|
+
|
228
|
+
this.version++;
|
229
|
+
this.ClearVertex(v);
|
230
|
+
|
231
|
+
// removing vertex
|
232
|
+
this.vertexOutEdges.Remove(v);
|
233
|
+
<% if (Bidirectional) {%>
|
234
|
+
this.vertexInEdges.Remove(v);
|
235
|
+
<%}%>
|
236
|
+
}
|
237
|
+
|
238
|
+
void IVertexMutableGraph.RemoveVertex(IVertex v)
|
239
|
+
{
|
240
|
+
this.RemoveVertex((<%= VertexType %>)v);
|
241
|
+
}
|
242
|
+
#endregion
|
243
|
+
|
244
|
+
#region IEdgeMutableGraph
|
245
|
+
/// <summary>
|
246
|
+
/// Gets the <%= EdgeTypeSee %> provider
|
247
|
+
/// </summary>
|
248
|
+
/// <value>
|
249
|
+
/// <%= EdgeTypeSee %> provider
|
250
|
+
/// </value>
|
251
|
+
public <%= EdgeProviderType %> EdgeProvider
|
252
|
+
{
|
253
|
+
get
|
254
|
+
{
|
255
|
+
return this.edgeProvider;
|
256
|
+
}
|
257
|
+
}
|
258
|
+
|
259
|
+
IEdgeProvider IEdgeMutableGraph.EdgeProvider
|
260
|
+
{
|
261
|
+
get
|
262
|
+
{
|
263
|
+
return this.EdgeProvider;
|
264
|
+
}
|
265
|
+
}
|
266
|
+
|
267
|
+
/// <summary>
|
268
|
+
/// Add a new vertex from source to target
|
269
|
+
///
|
270
|
+
/// Complexity: 2 search + 1 insertion
|
271
|
+
/// </summary>
|
272
|
+
/// <param name="source">Source vertex</param>
|
273
|
+
/// <param name="target">Target vertex</param>
|
274
|
+
/// <returns>Created Edge</returns>
|
275
|
+
/// <exception cref="ArgumentNullException">
|
276
|
+
/// source or target is a null reference
|
277
|
+
/// </exception>
|
278
|
+
/// <exception cref="Exception">source or target are not part of the graph</exception>
|
279
|
+
public virtual <%= EdgeType %> AddEdge(
|
280
|
+
<%= VertexType %> source,
|
281
|
+
<%= VertexType %> target
|
282
|
+
)
|
283
|
+
{
|
284
|
+
// look for the vertex in the list
|
285
|
+
if (!this.vertexOutEdges.Contains(source))
|
286
|
+
throw new VertexNotFoundException("Could not find source vertex");
|
287
|
+
if (!this.vertexOutEdges.Contains(target))
|
288
|
+
throw new VertexNotFoundException("Could not find target vertex");
|
289
|
+
|
290
|
+
// if parralel edges are not allowed check if already in the graph
|
291
|
+
if (!this.AllowParallelEdges)
|
292
|
+
{
|
293
|
+
if (ContainsEdge(source,target))
|
294
|
+
throw new Exception("Parallel edge not allowed");
|
295
|
+
}
|
296
|
+
|
297
|
+
this.version++;
|
298
|
+
// create edge
|
299
|
+
<%= EdgeType %> e = (<%= EdgeType %>)this.EdgeProvider.ProvideEdge(source,target);
|
300
|
+
this.vertexOutEdges[source].Add(e);
|
301
|
+
<% if (Bidirectional) {%>
|
302
|
+
this.vertexInEdges[target].Add(e);
|
303
|
+
<%}%>
|
304
|
+
|
305
|
+
return e;
|
306
|
+
}
|
307
|
+
|
308
|
+
IEdge IEdgeMutableGraph.AddEdge(
|
309
|
+
IVertex source,
|
310
|
+
IVertex target
|
311
|
+
)
|
312
|
+
{
|
313
|
+
return this.AddEdge((<%= VertexType %>)source,(<%= VertexType %>)target);
|
314
|
+
}
|
315
|
+
|
316
|
+
|
317
|
+
/// <summary>
|
318
|
+
/// Remove all edges to and from vertex u from the graph.
|
319
|
+
/// </summary>
|
320
|
+
/// <param name="v"></param>
|
321
|
+
public virtual void ClearVertex(<%= VertexType %> v)
|
322
|
+
{
|
323
|
+
if (v == null)
|
324
|
+
throw new ArgumentNullException("vertex");
|
325
|
+
|
326
|
+
this.version++;
|
327
|
+
// removing edges touching v
|
328
|
+
this.RemoveEdgeIf(new IsAdjacentEdgePredicate(v));
|
329
|
+
|
330
|
+
// removing edges
|
331
|
+
this.vertexOutEdges[v].Clear();
|
332
|
+
<% if (Bidirectional) {%>
|
333
|
+
this.vertexInEdges[v].Clear();
|
334
|
+
<%}%>
|
335
|
+
}
|
336
|
+
|
337
|
+
void IEdgeMutableGraph.ClearVertex(IVertex v)
|
338
|
+
{
|
339
|
+
this.ClearVertex((<%= VertexType %>)v);
|
340
|
+
}
|
341
|
+
|
342
|
+
|
343
|
+
/// <summary>
|
344
|
+
/// Removes an edge from the graph.
|
345
|
+
///
|
346
|
+
/// Complexity: 2 edges removed from the vertex edge list + 1 edge
|
347
|
+
/// removed from the edge list.
|
348
|
+
/// </summary>
|
349
|
+
/// <param name="e">edge to remove</param>
|
350
|
+
/// <exception cref="ArgumentNullException">
|
351
|
+
/// e is a null reference (Nothing in Visual Basic)
|
352
|
+
/// </exception>
|
353
|
+
/// <exception cref="EdgeNotFoundException">
|
354
|
+
/// <paramref name="e"/> is not part of the graph
|
355
|
+
/// </exception>
|
356
|
+
public virtual void RemoveEdge(<%= EdgeType %> e)
|
357
|
+
{
|
358
|
+
if (e == null)
|
359
|
+
throw new ArgumentNullException("e");
|
360
|
+
if (!this.ContainsEdge(e))
|
361
|
+
throw new EdgeNotFoundException("e");
|
362
|
+
|
363
|
+
this.version++;
|
364
|
+
// removing edge from vertices
|
365
|
+
<%= VertexType %> source= (<%= VertexType %>)e.Source;
|
366
|
+
<%= EdgeCollectionType %> outEdges = this.vertexOutEdges[source];
|
367
|
+
if (outEdges==null)
|
368
|
+
throw new VertexNotFoundException(source.ToString());
|
369
|
+
outEdges.Remove(e);
|
370
|
+
<% if (Bidirectional) {%>
|
371
|
+
<%= VertexType %> target= (<%= VertexType %>)e.Target;
|
372
|
+
<%= EdgeCollectionType %> inEdges = this.vertexInEdges[target];
|
373
|
+
if (inEdges==null)
|
374
|
+
throw new VertexNotFoundException(target.ToString());
|
375
|
+
inEdges.Remove(e);
|
376
|
+
<%}%>
|
377
|
+
}
|
378
|
+
|
379
|
+
void IEdgeMutableGraph.RemoveEdge(IEdge e)
|
380
|
+
{
|
381
|
+
this.RemoveEdge((<%= EdgeType %>)e);
|
382
|
+
}
|
383
|
+
|
384
|
+
/// <summary>
|
385
|
+
/// Remove the edge (u,v) from the graph.
|
386
|
+
/// If the graph allows parallel edges this remove all occurrences of
|
387
|
+
/// (u,v).
|
388
|
+
/// </summary>
|
389
|
+
/// <param name="u">source vertex</param>
|
390
|
+
/// <param name="v">target vertex</param>
|
391
|
+
public virtual void RemoveEdge(<%= VertexType %> u, <%= VertexType %> v)
|
392
|
+
{
|
393
|
+
if (u == null)
|
394
|
+
throw new ArgumentNullException("u");
|
395
|
+
if (v == null)
|
396
|
+
throw new ArgumentNullException("v");
|
397
|
+
|
398
|
+
this.version++;
|
399
|
+
// getting out-edges
|
400
|
+
<%= EdgeCollectionType %> outEdges = this.vertexOutEdges[u];
|
401
|
+
|
402
|
+
// marking edges to remove
|
403
|
+
<%= EdgeCollectionType %> removedEdges = new <%= EdgeCollectionType %>();
|
404
|
+
foreach(<%= EdgeType %> e in outEdges)
|
405
|
+
{
|
406
|
+
if (e.Target == v)
|
407
|
+
removedEdges.Add(e);
|
408
|
+
}
|
409
|
+
//removing out-edges
|
410
|
+
foreach(<%= EdgeType %> e in removedEdges)
|
411
|
+
outEdges.Remove(e);
|
412
|
+
|
413
|
+
<% if (Bidirectional) {%>
|
414
|
+
removedEdges.Clear();
|
415
|
+
<%= EdgeCollectionType %> inEdges = this.vertexInEdges[v];
|
416
|
+
foreach(<%= EdgeType %> e in inEdges)
|
417
|
+
{
|
418
|
+
if (e.Source == u)
|
419
|
+
removedEdges.Add(e);
|
420
|
+
}
|
421
|
+
//removing in-edges
|
422
|
+
foreach(<%= EdgeType %> e in removedEdges)
|
423
|
+
inEdges.Remove(e);
|
424
|
+
<%}%>
|
425
|
+
}
|
426
|
+
|
427
|
+
void IEdgeMutableGraph.RemoveEdge(IVertex u, IVertex v)
|
428
|
+
{
|
429
|
+
this.RemoveEdge((<%= VertexType %>) u, (<%= VertexType %>) v);
|
430
|
+
}
|
431
|
+
|
432
|
+
#endregion
|
433
|
+
|
434
|
+
#region ISerializableVertexListGraph
|
435
|
+
/// <summary>
|
436
|
+
/// Add a new vertex to the graph and returns it.
|
437
|
+
/// </summary>
|
438
|
+
/// <returns>Create vertex</returns>
|
439
|
+
internal virtual void AddVertex(<%= VertexType %> v)
|
440
|
+
{
|
441
|
+
if (v==null)
|
442
|
+
throw new ArgumentNullException("vertex");
|
443
|
+
if (this.vertexOutEdges.Contains(v))
|
444
|
+
throw new ArgumentException("vertex already in graph");
|
445
|
+
|
446
|
+
this.version++;
|
447
|
+
this.VertexProvider.UpdateVertex(v);
|
448
|
+
this.vertexOutEdges.Add(v);
|
449
|
+
<% if (Bidirectional) {%>
|
450
|
+
this.vertexInEdges.Add(v);
|
451
|
+
<%}%>
|
452
|
+
}
|
453
|
+
|
454
|
+
void ISerializableVertexListGraph.AddVertex(IVertex v)
|
455
|
+
{
|
456
|
+
this.AddVertex((<%= VertexType %>) v);
|
457
|
+
}
|
458
|
+
#endregion
|
459
|
+
|
460
|
+
#region ISerializableEdgeListGraph
|
461
|
+
/// <summary>
|
462
|
+
/// Used for serialization. Not for private use.
|
463
|
+
/// </summary>
|
464
|
+
/// <param name="e">edge to add.</param>
|
465
|
+
internal virtual void AddEdge(<%= EdgeType %> e)
|
466
|
+
{
|
467
|
+
if (e==null)
|
468
|
+
throw new ArgumentNullException("vertex");
|
469
|
+
if (e.GetType().IsAssignableFrom(EdgeProvider.EdgeType))
|
470
|
+
throw new ArgumentNullException("vertex type not valid");
|
471
|
+
|
472
|
+
<%= VertexType %> source= (<%= VertexType %>)e.Source;
|
473
|
+
if (!this.vertexOutEdges.Contains(source))
|
474
|
+
throw new VertexNotFoundException(source.ToString());
|
475
|
+
<%= VertexType %> target= (<%= VertexType %>)e.Target;
|
476
|
+
if (!this.vertexOutEdges.Contains(target))
|
477
|
+
throw new VertexNotFoundException(target.ToString());
|
478
|
+
|
479
|
+
// if parralel edges are not allowed check if already in the graph
|
480
|
+
if (!this.AllowParallelEdges)
|
481
|
+
{
|
482
|
+
if (ContainsEdge(source,target))
|
483
|
+
throw new ArgumentException("graph does not allow duplicate edges");
|
484
|
+
}
|
485
|
+
// create edge
|
486
|
+
this.EdgeProvider.UpdateEdge(e);
|
487
|
+
this.vertexOutEdges[source].Add(e);
|
488
|
+
<% if (Bidirectional) {%>
|
489
|
+
this.vertexInEdges[target].Add(e);
|
490
|
+
<%}%>
|
491
|
+
}
|
492
|
+
|
493
|
+
void ISerializableEdgeListGraph.AddEdge(IEdge e)
|
494
|
+
{
|
495
|
+
this.AddEdge((<%= EdgeType %>)e);
|
496
|
+
}
|
497
|
+
#endregion
|
498
|
+
|
499
|
+
#region IIncidenceGraph
|
500
|
+
/// <summary>
|
501
|
+
/// Gets a value indicating if the set of out-edges is empty
|
502
|
+
/// </summary>
|
503
|
+
/// <remarks>
|
504
|
+
/// <para>
|
505
|
+
/// Usually faster that calling <see cref="OutDegree"/>.
|
506
|
+
/// </para>
|
507
|
+
/// </remarks>
|
508
|
+
/// <value>
|
509
|
+
/// true if the out-edge set is empty, false otherwise.
|
510
|
+
/// </value>
|
511
|
+
/// <exception cref="ArgumentNullException">
|
512
|
+
/// v is a null reference (Nothing in Visual Basic)
|
513
|
+
/// </exception>
|
514
|
+
/// <exception cref="VertexNotFoundException">
|
515
|
+
/// v is not part of the graph.
|
516
|
+
/// </exception>
|
517
|
+
public bool OutEdgesEmpty(<%= VertexType %> v)
|
518
|
+
{
|
519
|
+
if (v == null)
|
520
|
+
throw new ArgumentNullException("v");
|
521
|
+
<%= EdgeCollectionType %> edges = this.vertexOutEdges[v];
|
522
|
+
if (edges==null)
|
523
|
+
throw new VertexNotFoundException(v.ToString());
|
524
|
+
return edges.Count==0;
|
525
|
+
}
|
526
|
+
|
527
|
+
bool IImplicitGraph.OutEdgesEmpty(IVertex v)
|
528
|
+
{
|
529
|
+
return this.OutEdgesEmpty((<%= VertexType %>)v);
|
530
|
+
}
|
531
|
+
|
532
|
+
/// <summary>
|
533
|
+
/// Returns the number of out-degree edges of v
|
534
|
+
/// </summary>
|
535
|
+
/// <param name="v">vertex</param>
|
536
|
+
/// <returns>number of out-edges of the <%= VertexTypeSee %> v</returns>
|
537
|
+
/// <exception cref="ArgumentNullException">
|
538
|
+
/// v is a null reference (Nothing in Visual Basic)
|
539
|
+
/// </exception>
|
540
|
+
/// <exception cref="VertexNotFoundException">
|
541
|
+
/// v is not part of the graph.
|
542
|
+
/// </exception>
|
543
|
+
public int OutDegree(<%= VertexType %> v)
|
544
|
+
{
|
545
|
+
if (v == null)
|
546
|
+
throw new ArgumentNullException("v");
|
547
|
+
<%= EdgeCollectionType %> edges = this.vertexOutEdges[v];
|
548
|
+
if (edges==null)
|
549
|
+
throw new VertexNotFoundException(v.ToString());
|
550
|
+
return edges.Count;
|
551
|
+
}
|
552
|
+
|
553
|
+
int IImplicitGraph.OutDegree(IVertex v)
|
554
|
+
{
|
555
|
+
return this.OutDegree((<%= VertexType %>)v);
|
556
|
+
}
|
557
|
+
|
558
|
+
/// <summary>
|
559
|
+
/// Returns an iterable collection over the edge connected to v
|
560
|
+
/// </summary>
|
561
|
+
/// <param name="v"></param>
|
562
|
+
/// <returns>out-edges of v</returns>
|
563
|
+
/// <exception cref="ArgumentNullException">
|
564
|
+
/// v is a null reference.
|
565
|
+
/// </exception>
|
566
|
+
/// <exception cref="VertexNotFoundException">
|
567
|
+
/// v is not part of the graph.
|
568
|
+
/// </exception>
|
569
|
+
<% if(IndexedEdges){%>
|
570
|
+
public IEdgeCollection OutEdges(<%= VertexType %> v)
|
571
|
+
<% }else{%>
|
572
|
+
public IEdgeEnumerable OutEdges(<%= VertexType %> v)
|
573
|
+
<%}%>
|
574
|
+
{
|
575
|
+
if (v == null)
|
576
|
+
throw new ArgumentNullException("v");
|
577
|
+
|
578
|
+
<%= EdgeCollectionType %> edges = this.vertexOutEdges[v];
|
579
|
+
if (edges==null)
|
580
|
+
throw new VertexNotFoundException(v.ToString());
|
581
|
+
return edges;
|
582
|
+
}
|
583
|
+
|
584
|
+
IEdgeEnumerable IImplicitGraph.OutEdges(IVertex v)
|
585
|
+
{
|
586
|
+
return this.OutEdges((<%= VertexType %>)v);
|
587
|
+
}
|
588
|
+
|
589
|
+
/// <summary>
|
590
|
+
/// Test is an edge (u,v) is part of the graph
|
591
|
+
/// </summary>
|
592
|
+
/// <param name="u">source vertex</param>
|
593
|
+
/// <param name="v">target vertex</param>
|
594
|
+
/// <returns>true if part of the graph</returns>
|
595
|
+
public bool ContainsEdge(<%= VertexType %> u,<%= VertexType %> v)
|
596
|
+
{
|
597
|
+
// try to find the edge
|
598
|
+
foreach(<%= EdgeType %> e in this.OutEdges(u))
|
599
|
+
{
|
600
|
+
if (e.Target == v)
|
601
|
+
return true;
|
602
|
+
}
|
603
|
+
return false;
|
604
|
+
}
|
605
|
+
|
606
|
+
bool IIncidenceGraph.ContainsEdge(IVertex u, IVertex v)
|
607
|
+
{
|
608
|
+
return this.ContainsEdge((<%= VertexType %>)u,(<%= VertexType %>)v);
|
609
|
+
}
|
610
|
+
#endregion
|
611
|
+
|
612
|
+
#region IFilteredIncidenceGraph
|
613
|
+
/// <summary>
|
614
|
+
/// Returns the first out-edge that matches the predicate
|
615
|
+
/// </summary>
|
616
|
+
/// <param name="v"></param>
|
617
|
+
/// <param name="ep">Edge predicate</param>
|
618
|
+
/// <returns>null if not found, otherwize the first Edge that
|
619
|
+
/// matches the predicate.</returns>
|
620
|
+
/// <exception cref="ArgumentNullException">v or ep is null</exception>
|
621
|
+
public <%= EdgeType %> SelectSingleOutEdge(<%= VertexType %> v, IEdgePredicate ep)
|
622
|
+
{
|
623
|
+
if (ep==null)
|
624
|
+
throw new ArgumentNullException("ep");
|
625
|
+
|
626
|
+
foreach(<%= EdgeType %> e in this.SelectOutEdges(v,ep))
|
627
|
+
return e;
|
628
|
+
|
629
|
+
return null;
|
630
|
+
}
|
631
|
+
|
632
|
+
IEdge IFilteredIncidenceGraph.SelectSingleOutEdge(IVertex v, IEdgePredicate ep)
|
633
|
+
{
|
634
|
+
return this.SelectSingleOutEdge((<%= VertexType %>)v,ep);
|
635
|
+
}
|
636
|
+
|
637
|
+
/// <summary>
|
638
|
+
/// Returns the collection of out-edges that matches the predicate
|
639
|
+
/// </summary>
|
640
|
+
/// <param name="v"></param>
|
641
|
+
/// <param name="ep">Edge predicate</param>
|
642
|
+
/// <returns>enumerable colleciton of vertices that matches the
|
643
|
+
/// criteron</returns>
|
644
|
+
/// <exception cref="ArgumentNullException">v or ep is null</exception>
|
645
|
+
public IEdgeEnumerable SelectOutEdges(<%= VertexType %> v, IEdgePredicate ep)
|
646
|
+
{
|
647
|
+
if (v==null)
|
648
|
+
throw new ArgumentNullException("v");
|
649
|
+
if (ep==null)
|
650
|
+
throw new ArgumentNullException("ep");
|
651
|
+
|
652
|
+
return new FilteredEdgeEnumerable(this.OutEdges(v),ep);
|
653
|
+
}
|
654
|
+
|
655
|
+
IEdgeEnumerable IFilteredIncidenceGraph.SelectOutEdges(IVertex v, IEdgePredicate ep)
|
656
|
+
{
|
657
|
+
return this.SelectOutEdges((<%= VertexType %>)v,ep);
|
658
|
+
}
|
659
|
+
|
660
|
+
|
661
|
+
/// <summary>
|
662
|
+
/// Remove all the edges from graph g for which the predicate pred
|
663
|
+
/// returns true.
|
664
|
+
/// </summary>
|
665
|
+
/// <param name="pred">edge predicate</param>
|
666
|
+
public virtual void RemoveEdgeIf(IEdgePredicate pred)
|
667
|
+
{
|
668
|
+
if (pred == null)
|
669
|
+
throw new ArgumentNullException("predicate");
|
670
|
+
|
671
|
+
// marking edge for removal
|
672
|
+
<%= EdgeCollectionType %> removedEdges = new <%= EdgeCollectionType %>();
|
673
|
+
foreach(<%= EdgeType %> e in Edges)
|
674
|
+
{
|
675
|
+
if (pred.Test(e))
|
676
|
+
removedEdges.Add(e);
|
677
|
+
}
|
678
|
+
|
679
|
+
// removing edges
|
680
|
+
foreach(<%= EdgeType %> e in removedEdges)
|
681
|
+
this.RemoveEdge(e);
|
682
|
+
}
|
683
|
+
#endregion
|
684
|
+
|
685
|
+
#region IMutableIncidenceGraph
|
686
|
+
/// <summary>
|
687
|
+
/// Remove all the out-edges of vertex u for which the predicate pred
|
688
|
+
/// returns true.
|
689
|
+
/// </summary>
|
690
|
+
/// <param name="u">vertex</param>
|
691
|
+
/// <param name="pred">edge predicate</param>
|
692
|
+
public virtual void RemoveOutEdgeIf(<%= VertexType %> u, IEdgePredicate pred)
|
693
|
+
{
|
694
|
+
if (u==null)
|
695
|
+
throw new ArgumentNullException("u");
|
696
|
+
if (pred == null)
|
697
|
+
throw new ArgumentNullException("pred");
|
698
|
+
|
699
|
+
<%= EdgeCollectionType %> edges = this.vertexOutEdges[u];
|
700
|
+
<%= EdgeCollectionType %> removedEdges = new <%= EdgeCollectionType %>();
|
701
|
+
foreach(<%= EdgeType %> e in edges)
|
702
|
+
{
|
703
|
+
if (pred.Test(e))
|
704
|
+
removedEdges.Add(e);
|
705
|
+
}
|
706
|
+
|
707
|
+
foreach(<%= EdgeType %> e in removedEdges)
|
708
|
+
this.RemoveEdge(e);
|
709
|
+
}
|
710
|
+
|
711
|
+
void IMutableIncidenceGraph.RemoveOutEdgeIf(IVertex u, IEdgePredicate pred)
|
712
|
+
{
|
713
|
+
this.RemoveOutEdgeIf((<%= VertexType %>)u,pred);
|
714
|
+
}
|
715
|
+
#endregion
|
716
|
+
|
717
|
+
<% if (IndexedEdges){%>
|
718
|
+
#region IIndexedIncidenceGraph
|
719
|
+
IEdgeCollection IIndexedIncidenceGraph.OutEdges(IVertex v)
|
720
|
+
{
|
721
|
+
return this.OutEdges((<%= VertexType %>)v);
|
722
|
+
}
|
723
|
+
#endregion
|
724
|
+
<%}%>
|
725
|
+
|
726
|
+
#region IVertexListGraph
|
727
|
+
/// <summary>
|
728
|
+
/// Gets a value indicating if the vertex set is empty
|
729
|
+
/// </summary>
|
730
|
+
/// <para>
|
731
|
+
/// Usually faster (O(1)) that calling <c>VertexCount</c>.
|
732
|
+
/// </para>
|
733
|
+
/// <value>
|
734
|
+
/// true if the vertex set is empty, false otherwise.
|
735
|
+
/// </value>
|
736
|
+
public bool VerticesEmpty
|
737
|
+
{
|
738
|
+
get
|
739
|
+
{
|
740
|
+
return this.vertexOutEdges.Count==0;
|
741
|
+
}
|
742
|
+
}
|
743
|
+
|
744
|
+
/// <summary>
|
745
|
+
/// Gets the number of vertices
|
746
|
+
/// </summary>
|
747
|
+
/// <value>
|
748
|
+
/// Number of vertices in the graph
|
749
|
+
/// </value>
|
750
|
+
public int VerticesCount
|
751
|
+
{
|
752
|
+
get
|
753
|
+
{
|
754
|
+
return this.vertexOutEdges.Count;
|
755
|
+
}
|
756
|
+
}
|
757
|
+
|
758
|
+
/// <summary>
|
759
|
+
/// Enumerable collection of vertices.
|
760
|
+
/// </summary>
|
761
|
+
public IVertexEnumerable Vertices
|
762
|
+
{
|
763
|
+
get
|
764
|
+
{
|
765
|
+
return this.vertexOutEdges.Vertices;
|
766
|
+
}
|
767
|
+
}
|
768
|
+
|
769
|
+
/// <summary>
|
770
|
+
/// Tests if a <%= VertexTypeSee %> is part of the graph
|
771
|
+
/// </summary>
|
772
|
+
/// <param name="v">Vertex to test</param>
|
773
|
+
/// <returns>true if is part of the graph, false otherwize</returns>
|
774
|
+
public bool ContainsVertex(<%= VertexType %> v)
|
775
|
+
{
|
776
|
+
return this.vertexOutEdges.Contains(v);
|
777
|
+
}
|
778
|
+
|
779
|
+
bool IVertexListGraph.ContainsVertex(IVertex v)
|
780
|
+
{
|
781
|
+
return this.ContainsVertex((<%= VertexType %>)v);
|
782
|
+
}
|
783
|
+
#endregion
|
784
|
+
|
785
|
+
#region IFilteredVertexListGraph
|
786
|
+
/// <summary>
|
787
|
+
/// Returns the first <%= VertexTypeSee %> that matches the predicate
|
788
|
+
/// </summary>
|
789
|
+
/// <param name="vp">vertex predicate</param>
|
790
|
+
/// <returns>null if not found, otherwize the first vertex that
|
791
|
+
/// matches the predicate.</returns>
|
792
|
+
/// <exception cref="ArgumentNullException">vp is null</exception>
|
793
|
+
public <%= VertexType %> SelectSingleVertex(IVertexPredicate vp)
|
794
|
+
{
|
795
|
+
if (vp == null)
|
796
|
+
throw new ArgumentNullException("vertex predicate");
|
797
|
+
|
798
|
+
foreach(<%= VertexType %> v in this.SelectVertices(vp))
|
799
|
+
return v;
|
800
|
+
return null;
|
801
|
+
}
|
802
|
+
|
803
|
+
IVertex IFilteredVertexListGraph.SelectSingleVertex(IVertexPredicate vp)
|
804
|
+
{
|
805
|
+
return this.SelectSingleVertex(vp);
|
806
|
+
}
|
807
|
+
|
808
|
+
/// <summary>
|
809
|
+
/// Returns the collection of vertices that matches the predicate
|
810
|
+
/// </summary>
|
811
|
+
/// <param name="vp">vertex predicate</param>
|
812
|
+
/// <returns>enumerable colleciton of vertices that matches the
|
813
|
+
/// criteron</returns>
|
814
|
+
/// <exception cref="ArgumentNullException">vp is null</exception>
|
815
|
+
public IVertexEnumerable SelectVertices(IVertexPredicate vp)
|
816
|
+
{
|
817
|
+
if (vp == null)
|
818
|
+
throw new ArgumentNullException("vertex predicate");
|
819
|
+
|
820
|
+
return new FilteredVertexEnumerable(Vertices,vp);
|
821
|
+
}
|
822
|
+
#endregion
|
823
|
+
|
824
|
+
#region EdgeListGraph
|
825
|
+
/// <summary>
|
826
|
+
/// Gets a value indicating if the vertex set is empty
|
827
|
+
/// </summary>
|
828
|
+
/// <remarks>
|
829
|
+
/// <para>
|
830
|
+
/// Usually faster that calling <see cref="EdgesCount"/>.
|
831
|
+
/// </para>
|
832
|
+
/// </remarks>
|
833
|
+
/// <value>
|
834
|
+
/// true if the vertex set is empty, false otherwise.
|
835
|
+
/// </value>
|
836
|
+
public bool EdgesEmpty
|
837
|
+
{
|
838
|
+
get
|
839
|
+
{
|
840
|
+
return this.EdgesCount==0;
|
841
|
+
}
|
842
|
+
}
|
843
|
+
|
844
|
+
/// <summary>
|
845
|
+
/// Gets the edge count
|
846
|
+
/// </summary>
|
847
|
+
/// <remarks>
|
848
|
+
/// Edges count
|
849
|
+
/// </remarks>
|
850
|
+
public int EdgesCount
|
851
|
+
{
|
852
|
+
get
|
853
|
+
{
|
854
|
+
int n = 0;
|
855
|
+
foreach(DictionaryEntry d in vertexOutEdges)
|
856
|
+
{
|
857
|
+
n+=((<%= EdgeCollectionType %>)d.Value).Count;
|
858
|
+
}
|
859
|
+
return n;
|
860
|
+
}
|
861
|
+
}
|
862
|
+
|
863
|
+
/// <summary>
|
864
|
+
/// Enumerable collection of edges.
|
865
|
+
/// </summary>
|
866
|
+
public IEdgeEnumerable Edges
|
867
|
+
{
|
868
|
+
get
|
869
|
+
{
|
870
|
+
return this.vertexOutEdges.Edges;
|
871
|
+
}
|
872
|
+
}
|
873
|
+
|
874
|
+
/// <summary>
|
875
|
+
/// Tests if a (<%= EdgeTypeSee %>) is part of the graph
|
876
|
+
/// </summary>
|
877
|
+
/// <param name="e">Edge to test</param>
|
878
|
+
/// <returns>true if is part of the graph, false otherwize</returns>
|
879
|
+
public bool ContainsEdge(<%= EdgeType %> e)
|
880
|
+
{
|
881
|
+
foreach(DictionaryEntry di in this.vertexOutEdges)
|
882
|
+
{
|
883
|
+
<%= EdgeCollectionType %> es = (<%= EdgeCollectionType %>)di.Value;
|
884
|
+
if (es.Contains(e))
|
885
|
+
return true;
|
886
|
+
}
|
887
|
+
return false;
|
888
|
+
}
|
889
|
+
|
890
|
+
bool IEdgeListGraph.ContainsEdge(IEdge e)
|
891
|
+
{
|
892
|
+
return this.ContainsEdge((<%= EdgeType %>)e);
|
893
|
+
}
|
894
|
+
#endregion
|
895
|
+
|
896
|
+
#region IFileteredEdgeListGraph
|
897
|
+
/// <summary>
|
898
|
+
/// Returns the first Edge that matches the predicate
|
899
|
+
/// </summary>
|
900
|
+
/// <param name="ep">Edge predicate</param>
|
901
|
+
/// <returns>null if not found, otherwize the first Edge that
|
902
|
+
/// matches the predicate.</returns>
|
903
|
+
/// <exception cref="ArgumentNullException">ep is null</exception>
|
904
|
+
public <%= EdgeType %> SelectSingleEdge(IEdgePredicate ep)
|
905
|
+
{
|
906
|
+
if (ep == null)
|
907
|
+
throw new ArgumentNullException("edge predicate");
|
908
|
+
foreach(<%= EdgeType %> e in this.SelectEdges(ep))
|
909
|
+
return e;
|
910
|
+
return null;
|
911
|
+
}
|
912
|
+
|
913
|
+
IEdge IFilteredEdgeListGraph.SelectSingleEdge(IEdgePredicate ep)
|
914
|
+
{
|
915
|
+
return this.SelectSingleEdge(ep);
|
916
|
+
}
|
917
|
+
|
918
|
+
/// <summary>
|
919
|
+
/// Returns the collection of edges that matches the predicate
|
920
|
+
/// </summary>
|
921
|
+
/// <param name="ep">Edge predicate</param>
|
922
|
+
/// <returns>enumerable colleciton of vertices that matches the
|
923
|
+
/// criteron</returns>
|
924
|
+
/// <exception cref="ArgumentNullException">ep is null</exception>
|
925
|
+
public IEdgeEnumerable SelectEdges(IEdgePredicate ep)
|
926
|
+
{
|
927
|
+
if (ep == null)
|
928
|
+
throw new ArgumentNullException("edge predicate");
|
929
|
+
|
930
|
+
return new FilteredEdgeEnumerable(Edges,ep);
|
931
|
+
}
|
932
|
+
#endregion
|
933
|
+
|
934
|
+
#region IAdjacencyGraph
|
935
|
+
/// <summary>
|
936
|
+
/// Gets an enumerable collection of adjacent vertices
|
937
|
+
/// </summary>
|
938
|
+
/// <param name="v"></param>
|
939
|
+
/// <returns>Enumerable collection of adjacent vertices</returns>
|
940
|
+
public IVertexEnumerable AdjacentVertices(<%= VertexType %> v)
|
941
|
+
{
|
942
|
+
return new TargetVertexEnumerable(this.OutEdges(v));
|
943
|
+
}
|
944
|
+
|
945
|
+
IVertexEnumerable IAdjacencyGraph.AdjacentVertices(IVertex v)
|
946
|
+
{
|
947
|
+
return AdjacentVertices((<%= VertexType %>)v);
|
948
|
+
}
|
949
|
+
#endregion
|
950
|
+
|
951
|
+
<%if (Bidirectional){%>
|
952
|
+
#region IBidirectionalGraph
|
953
|
+
/// <summary>
|
954
|
+
/// Gets a value indicating if the set of in-edges is empty
|
955
|
+
/// </summary>
|
956
|
+
/// <remarks>
|
957
|
+
/// <para>
|
958
|
+
/// Usually faster that calling <see cref="InDegree"/>.
|
959
|
+
/// </para>
|
960
|
+
/// </remarks>
|
961
|
+
/// <value>
|
962
|
+
/// true if the in-edge set is empty, false otherwise.
|
963
|
+
/// </value>
|
964
|
+
/// <exception cref="ArgumentNullException">
|
965
|
+
/// v is a null reference (Nothing in Visual Basic)
|
966
|
+
/// </exception>
|
967
|
+
/// <exception cref="VertexNotFoundException">
|
968
|
+
/// <paramref name="v"/> is not part of the graph.
|
969
|
+
/// </exception>
|
970
|
+
public bool InEdgesEmpty(<%= VertexType%> v)
|
971
|
+
{
|
972
|
+
if (v==null)
|
973
|
+
throw new ArgumentNullException("v");
|
974
|
+
<%= EdgeCollectionType %> edges = this.vertexInEdges[v];
|
975
|
+
if (edges==null)
|
976
|
+
throw new VertexNotFoundException("v");
|
977
|
+
return edges.Count==0;
|
978
|
+
}
|
979
|
+
|
980
|
+
bool IBidirectionalGraph.InEdgesEmpty(IVertex v)
|
981
|
+
{
|
982
|
+
return this.InEdgesEmpty((<%= VertexType %>)v);
|
983
|
+
}
|
984
|
+
|
985
|
+
/// <summary>
|
986
|
+
/// Returns the number of in-degree edges of v
|
987
|
+
/// </summary>
|
988
|
+
/// <param name="v"></param>
|
989
|
+
/// <returns>number of in-edges of the vertex v</returns>
|
990
|
+
/// <exception cref="ArgumentNullException">
|
991
|
+
/// v is a null reference (Nothing in Visual Basic)
|
992
|
+
/// </exception>
|
993
|
+
/// <exception cref="VertexNotFoundException">
|
994
|
+
/// <paramref name="v"/> is not part of the graph.
|
995
|
+
/// </exception>
|
996
|
+
public int InDegree(<%= VertexType %> v)
|
997
|
+
{
|
998
|
+
if (v == null)
|
999
|
+
throw new ArgumentNullException("v");
|
1000
|
+
<%= EdgeCollectionType %> edges = this.vertexInEdges[v];
|
1001
|
+
if (edges==null)
|
1002
|
+
throw new VertexNotFoundException("v");
|
1003
|
+
return edges.Count;
|
1004
|
+
}
|
1005
|
+
int IBidirectionalGraph.InDegree(IVertex v)
|
1006
|
+
{
|
1007
|
+
return this.InDegree((<%= VertexType %>)v);
|
1008
|
+
}
|
1009
|
+
|
1010
|
+
/// <summary>
|
1011
|
+
/// Returns an iterable collection over the in-edge connected to v
|
1012
|
+
/// </summary>
|
1013
|
+
/// <param name="v"></param>
|
1014
|
+
/// <returns>in-edges of v</returns>
|
1015
|
+
/// <exception cref="ArgumentNullException">
|
1016
|
+
/// v is a null reference (Nothing in Visual Basic)
|
1017
|
+
/// </exception>
|
1018
|
+
/// <exception cref="VertexNotFoundException">
|
1019
|
+
/// <paramref name="v"/> is not part of the graph.
|
1020
|
+
/// </exception>
|
1021
|
+
<%if (IndexedEdges){%>
|
1022
|
+
public IEdgeCollection InEdges(<%= VertexType %> v)
|
1023
|
+
<%}else{%>
|
1024
|
+
public IEdgeEnumerable InEdges((<%= VertexType %>) v)
|
1025
|
+
<%}%>
|
1026
|
+
{
|
1027
|
+
if (v == null)
|
1028
|
+
throw new ArgumentNullException("v");
|
1029
|
+
<%= EdgeCollectionType %> edges = this.vertexInEdges[v];
|
1030
|
+
if (edges==null)
|
1031
|
+
throw new VertexNotFoundException(v.ToString());
|
1032
|
+
return edges;
|
1033
|
+
}
|
1034
|
+
|
1035
|
+
/// <summary>
|
1036
|
+
/// Incidence graph implementation
|
1037
|
+
/// </summary>
|
1038
|
+
IEdgeEnumerable IBidirectionalGraph.InEdges(IVertex v)
|
1039
|
+
{
|
1040
|
+
return this.InEdges((<%= VertexType %>)v);
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
/// <summary>
|
1044
|
+
/// Gets a value indicating if the set of edges connected to v is empty
|
1045
|
+
/// </summary>
|
1046
|
+
/// <remarks>
|
1047
|
+
/// <para>
|
1048
|
+
/// Usually faster that calling <see cref="Degree"/>.
|
1049
|
+
/// </para>
|
1050
|
+
/// </remarks>
|
1051
|
+
/// <value>
|
1052
|
+
/// true if the adjacent edge set is empty, false otherwise.
|
1053
|
+
/// </value>
|
1054
|
+
/// <exception cref="ArgumentNullException">v is a null reference</exception>
|
1055
|
+
public bool AdjacentEdgesEmpty(<%= VertexType %> v)
|
1056
|
+
{
|
1057
|
+
if (v==null)
|
1058
|
+
throw new ArgumentNullException("v");
|
1059
|
+
return this.OutEdgesEmpty(v) && this.InEdgesEmpty(v);
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
bool IBidirectionalGraph.AdjacentEdgesEmpty(IVertex v)
|
1063
|
+
{
|
1064
|
+
return this.AdjacentEdgesEmpty((<%= VertexType %>)v);
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
/// <summary>
|
1068
|
+
/// Returns the number of in-edges plus out-edges.
|
1069
|
+
/// </summary>
|
1070
|
+
/// <param name="v"></param>
|
1071
|
+
/// <returns></returns>
|
1072
|
+
public int Degree(<%= VertexType %> v)
|
1073
|
+
{
|
1074
|
+
if (v == null)
|
1075
|
+
throw new ArgumentNullException("v");
|
1076
|
+
<%= EdgeCollectionType %> outEdges = this.vertexOutEdges[v];
|
1077
|
+
if (outEdges==null)
|
1078
|
+
throw new VertexNotFoundException("v");
|
1079
|
+
<%= EdgeCollectionType %> inEdges = this.vertexInEdges[v];
|
1080
|
+
Debug.Assert(inEdges!=null);
|
1081
|
+
return outEdges.Count + inEdges.Count;
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
int IBidirectionalGraph.Degree(IVertex v)
|
1085
|
+
{
|
1086
|
+
return this.Degree((<%= VertexType %>)v);
|
1087
|
+
}
|
1088
|
+
#endregion
|
1089
|
+
|
1090
|
+
#region IFilteredBidirectionalGraph
|
1091
|
+
/// <summary>
|
1092
|
+
/// Returns the first in-edge that matches the predicate
|
1093
|
+
/// </summary>
|
1094
|
+
/// <param name="v"></param>
|
1095
|
+
/// <param name="ep">Edge predicate</param>
|
1096
|
+
/// <returns>null if not found, otherwize the first Edge that
|
1097
|
+
/// matches the predicate.</returns>
|
1098
|
+
/// <exception cref="ArgumentNullException">v or ep is null</exception>
|
1099
|
+
public <%= EdgeType %> SelectSingleInEdge(<%= VertexType %> v, IEdgePredicate ep)
|
1100
|
+
{
|
1101
|
+
if (ep==null)
|
1102
|
+
throw new ArgumentNullException("edge predicate");
|
1103
|
+
|
1104
|
+
foreach(<%= EdgeType %> e in this.SelectInEdges(v,ep))
|
1105
|
+
return e;
|
1106
|
+
|
1107
|
+
return null;
|
1108
|
+
}
|
1109
|
+
IEdge IFilteredBidirectionalGraph.SelectSingleInEdge(IVertex v, IEdgePredicate ep)
|
1110
|
+
{
|
1111
|
+
return this.SelectSingleInEdge((<%= VertexType %>)v, ep);
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
/// <summary>
|
1115
|
+
/// Returns the collection of in-edges that matches the predicate
|
1116
|
+
/// </summary>
|
1117
|
+
/// <param name="v"></param>
|
1118
|
+
/// <param name="ep">Edge predicate</param>
|
1119
|
+
/// <returns>enumerable colleciton of vertices that matches the
|
1120
|
+
/// criteron</returns>
|
1121
|
+
/// <exception cref="ArgumentNullException">v or ep is null</exception>
|
1122
|
+
public IEdgeEnumerable SelectInEdges(<%= VertexType %> v, IEdgePredicate ep)
|
1123
|
+
{
|
1124
|
+
if (v==null)
|
1125
|
+
throw new ArgumentNullException("vertex");
|
1126
|
+
if (ep==null)
|
1127
|
+
throw new ArgumentNullException("edge predicate");
|
1128
|
+
|
1129
|
+
return new FilteredEdgeEnumerable(this.InEdges(v),ep);
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
/// <summary>
|
1133
|
+
///
|
1134
|
+
/// </summary>
|
1135
|
+
/// <param name="v"></param>
|
1136
|
+
/// <param name="ep"></param>
|
1137
|
+
/// <returns></returns>
|
1138
|
+
IEdgeEnumerable IFilteredBidirectionalGraph.SelectInEdges(IVertex v, IEdgePredicate ep)
|
1139
|
+
{
|
1140
|
+
return this.SelectInEdges((<%= VertexType %>)v,ep);
|
1141
|
+
}
|
1142
|
+
#endregion
|
1143
|
+
|
1144
|
+
#region IMutableBidirectionalGraph
|
1145
|
+
|
1146
|
+
/// <summary>
|
1147
|
+
/// Remove all the out-edges of vertex u for which the predicate pred
|
1148
|
+
/// returns true.
|
1149
|
+
/// </summary>
|
1150
|
+
/// <param name="u">vertex</param>
|
1151
|
+
/// <param name="pred">edge predicate</param>
|
1152
|
+
public void RemoveInEdgeIf(<%= VertexType %> u, IEdgePredicate pred)
|
1153
|
+
{
|
1154
|
+
if (u==null)
|
1155
|
+
throw new ArgumentNullException("vertex u");
|
1156
|
+
if (pred == null)
|
1157
|
+
throw new ArgumentNullException("predicate");
|
1158
|
+
|
1159
|
+
<%= EdgeCollectionType %> edges = this.vertexInEdges[u];
|
1160
|
+
<%= EdgeCollectionType %> removedEdges = new <%= EdgeCollectionType %>();
|
1161
|
+
foreach(<%= EdgeType %> e in edges)
|
1162
|
+
{
|
1163
|
+
if (pred.Test(e))
|
1164
|
+
removedEdges.Add(e);
|
1165
|
+
}
|
1166
|
+
|
1167
|
+
foreach(<%= EdgeType %> e in removedEdges)
|
1168
|
+
this.RemoveEdge(e);
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
void IMutableBidirectionalGraph.RemoveInEdgeIf(IVertex u, IEdgePredicate pred)
|
1172
|
+
{
|
1173
|
+
this.RemoveInEdgeIf((<%= VertexType %>)u,pred);
|
1174
|
+
}
|
1175
|
+
|
1176
|
+
#endregion
|
1177
|
+
<%}%>
|
1178
|
+
|
1179
|
+
#region <%= EdgeCollectionType %>
|
1180
|
+
private class <%= EdgeCollectionType %> :
|
1181
|
+
<%= EdgeCollectionBaseType %>
|
1182
|
+
<% if (IndexedEdges){%>
|
1183
|
+
,IEdgeCollection
|
1184
|
+
<%}else{%>
|
1185
|
+
,IEdgeEnumerable
|
1186
|
+
<%}%>
|
1187
|
+
{
|
1188
|
+
/// <summary>
|
1189
|
+
/// Initializes a new empty instance of the
|
1190
|
+
/// <see cref="<%= EdgeCollectionType %>"/> class.
|
1191
|
+
/// </summary>
|
1192
|
+
public <%= EdgeCollectionType %>()
|
1193
|
+
{}
|
1194
|
+
|
1195
|
+
/// <summary>
|
1196
|
+
/// Adds an instance of type <%= EdgeTypeSee %> to the end of this
|
1197
|
+
/// <see cref="<%= EdgeCollectionType %>"/>.
|
1198
|
+
/// </summary>
|
1199
|
+
/// <param name="value">
|
1200
|
+
/// The Edge to be added to the end of this EdgeCollection.
|
1201
|
+
/// </param>
|
1202
|
+
internal void Add(<%= EdgeType %> value)
|
1203
|
+
{
|
1204
|
+
this.List.Add(value);
|
1205
|
+
}
|
1206
|
+
|
1207
|
+
/// <summary>
|
1208
|
+
/// Removes the first occurrence of a specific Edge from this EdgeCollection.
|
1209
|
+
/// </summary>
|
1210
|
+
/// <param name="value">
|
1211
|
+
/// The Edge value to remove from this EdgeCollection.
|
1212
|
+
/// </param>
|
1213
|
+
internal void Remove(IEdge value)
|
1214
|
+
{
|
1215
|
+
this.List.Remove(value);
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
<% if (IndexedEdges){%>
|
1219
|
+
#region IEdgeCollection
|
1220
|
+
/// <summary>
|
1221
|
+
/// Determines whether a specfic <%= EdgeTypeSee %> value is in this EdgeCollection.
|
1222
|
+
/// </summary>
|
1223
|
+
/// <param name="value">
|
1224
|
+
/// edge value to locate in this <see cref="<%= EdgeCollectionType %>"/>.
|
1225
|
+
/// </param>
|
1226
|
+
/// <returns>
|
1227
|
+
/// true if value is found in this collection;
|
1228
|
+
/// false otherwise.
|
1229
|
+
/// </returns>
|
1230
|
+
public bool Contains(<%= EdgeType %> value)
|
1231
|
+
{
|
1232
|
+
return this.List.Contains(value);
|
1233
|
+
}
|
1234
|
+
|
1235
|
+
bool IEdgeCollection.Contains(IEdge value)
|
1236
|
+
{
|
1237
|
+
return this.Contains((<%= EdgeType %>)value);
|
1238
|
+
}
|
1239
|
+
|
1240
|
+
/// <summary>
|
1241
|
+
/// Gets or sets the Edge at the given index in this EdgeCollection.
|
1242
|
+
/// </summary>
|
1243
|
+
public <%= EdgeType %> this[int index]
|
1244
|
+
{
|
1245
|
+
get
|
1246
|
+
{
|
1247
|
+
return (<%= EdgeType %>)this.List[index];
|
1248
|
+
}
|
1249
|
+
set
|
1250
|
+
{
|
1251
|
+
this.List[index] = value;
|
1252
|
+
}
|
1253
|
+
}
|
1254
|
+
|
1255
|
+
IEdge IEdgeCollection.this[int index]
|
1256
|
+
{
|
1257
|
+
get
|
1258
|
+
{
|
1259
|
+
return this[index];
|
1260
|
+
}
|
1261
|
+
set
|
1262
|
+
{
|
1263
|
+
this[index] = (<%= EdgeType %>)value;
|
1264
|
+
}
|
1265
|
+
}
|
1266
|
+
#endregion
|
1267
|
+
<%}%>
|
1268
|
+
|
1269
|
+
#region IEdgeEnumerable
|
1270
|
+
/// <summary>
|
1271
|
+
/// Returns an enumerator that can iterate through the elements of this EdgeCollection.
|
1272
|
+
/// </summary>
|
1273
|
+
/// <returns>
|
1274
|
+
/// An object that implements System.Collections.IEnumerator.
|
1275
|
+
/// </returns>
|
1276
|
+
public new IEdgeEnumerator GetEnumerator()
|
1277
|
+
{
|
1278
|
+
return new <%= EdgeEnumeratorType %>(this);
|
1279
|
+
}
|
1280
|
+
|
1281
|
+
private class <%= EdgeEnumeratorType %> : IEdgeEnumerator
|
1282
|
+
{
|
1283
|
+
private IEnumerator wrapped;
|
1284
|
+
|
1285
|
+
/// <summary>
|
1286
|
+
/// Create a new enumerator on the collection
|
1287
|
+
/// </summary>
|
1288
|
+
/// <param name="collection">collection to enumerate</param>
|
1289
|
+
public <%= EdgeEnumeratorType %>(<%= EdgeCollectionType %> collection)
|
1290
|
+
{
|
1291
|
+
this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
/// <summary>
|
1295
|
+
/// The current element.
|
1296
|
+
/// </summary>
|
1297
|
+
public <%= EdgeType %> Current
|
1298
|
+
{
|
1299
|
+
get
|
1300
|
+
{
|
1301
|
+
return (<%= EdgeType %>)this.wrapped.Current;
|
1302
|
+
}
|
1303
|
+
}
|
1304
|
+
#region IEdgeEnumerator
|
1305
|
+
IEdge IEdgeEnumerator.Current
|
1306
|
+
{
|
1307
|
+
get
|
1308
|
+
{
|
1309
|
+
return this.Current;
|
1310
|
+
}
|
1311
|
+
}
|
1312
|
+
#endregion
|
1313
|
+
#region IEnumerator
|
1314
|
+
object IEnumerator.Current
|
1315
|
+
{
|
1316
|
+
get
|
1317
|
+
{
|
1318
|
+
return this.Current;
|
1319
|
+
}
|
1320
|
+
}
|
1321
|
+
|
1322
|
+
/// <summary>
|
1323
|
+
/// Moves cursor to next element.
|
1324
|
+
/// </summary>
|
1325
|
+
/// <returns>true if current is valid, false otherwize</returns>
|
1326
|
+
public bool MoveNext()
|
1327
|
+
{
|
1328
|
+
return this.wrapped.MoveNext();
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
/// <summary>
|
1332
|
+
/// Resets the cursor to the position before the first element.
|
1333
|
+
/// </summary>
|
1334
|
+
public void Reset()
|
1335
|
+
{
|
1336
|
+
this.wrapped.Reset();
|
1337
|
+
}
|
1338
|
+
#endregion
|
1339
|
+
}
|
1340
|
+
#endregion
|
1341
|
+
}
|
1342
|
+
#endregion
|
1343
|
+
|
1344
|
+
#region <%= VertexEdgesDictionaryType %>
|
1345
|
+
private class <%= VertexEdgesDictionaryType %> :
|
1346
|
+
<%= VertexEdgesDictionaryBaseType %>
|
1347
|
+
{
|
1348
|
+
public <%= VertexEdgesDictionaryType %>()
|
1349
|
+
{}
|
1350
|
+
|
1351
|
+
public void Add(<%= VertexType %> u)
|
1352
|
+
{
|
1353
|
+
Debug.Assert(u!=null);
|
1354
|
+
this.Dictionary.Add(u, new <%= EdgeCollectionType %>() );
|
1355
|
+
}
|
1356
|
+
|
1357
|
+
public bool Contains(<%= VertexType %> key)
|
1358
|
+
{
|
1359
|
+
return this.Dictionary.Contains(key);
|
1360
|
+
}
|
1361
|
+
|
1362
|
+
public void Remove(<%= VertexType %> key)
|
1363
|
+
{
|
1364
|
+
this.Dictionary.Remove(key);
|
1365
|
+
}
|
1366
|
+
|
1367
|
+
public IVertexEnumerable Vertices
|
1368
|
+
{
|
1369
|
+
get
|
1370
|
+
{
|
1371
|
+
return new <%= VertexEdgesVertexEnumerableType %>(this.Dictionary.Keys);
|
1372
|
+
}
|
1373
|
+
}
|
1374
|
+
|
1375
|
+
public IEdgeEnumerable Edges
|
1376
|
+
{
|
1377
|
+
get
|
1378
|
+
{
|
1379
|
+
return new <%= VertexEdgesEdgeEnumerableType %>(this.Dictionary.Values);
|
1380
|
+
}
|
1381
|
+
}
|
1382
|
+
|
1383
|
+
public <%= EdgeCollectionType %> this[<%= VertexType %> v]
|
1384
|
+
{
|
1385
|
+
get
|
1386
|
+
{
|
1387
|
+
return (<%= EdgeCollectionType %>)this.Dictionary[v];
|
1388
|
+
}
|
1389
|
+
}
|
1390
|
+
|
1391
|
+
#region Vertex Enumerable/Enumerator
|
1392
|
+
private class <%= VertexEdgesVertexEnumerableType %> :
|
1393
|
+
IVertexEnumerable
|
1394
|
+
{
|
1395
|
+
private IEnumerable en;
|
1396
|
+
public <%= VertexEdgesVertexEnumerableType %>(IEnumerable en)
|
1397
|
+
{
|
1398
|
+
Debug.Assert(en!=null);
|
1399
|
+
this.en = en;
|
1400
|
+
}
|
1401
|
+
public IVertexEnumerator GetEnumerator()
|
1402
|
+
{
|
1403
|
+
return new <%= VertexEdgesVertexEnumeratorType %>(en);
|
1404
|
+
}
|
1405
|
+
IEnumerator IEnumerable.GetEnumerator()
|
1406
|
+
{
|
1407
|
+
return this.GetEnumerator();
|
1408
|
+
}
|
1409
|
+
|
1410
|
+
#region Enumerator
|
1411
|
+
private class <%= VertexEdgesVertexEnumeratorType %> :
|
1412
|
+
IVertexEnumerator
|
1413
|
+
{
|
1414
|
+
private IEnumerator en;
|
1415
|
+
public <%= VertexEdgesVertexEnumeratorType %>(IEnumerable col)
|
1416
|
+
{
|
1417
|
+
Debug.Assert(col!=null);
|
1418
|
+
this.en = col.GetEnumerator();
|
1419
|
+
}
|
1420
|
+
|
1421
|
+
public <%= VertexType %> Current
|
1422
|
+
{
|
1423
|
+
get
|
1424
|
+
{
|
1425
|
+
return (<%= VertexType %>)this.en.Current;
|
1426
|
+
}
|
1427
|
+
}
|
1428
|
+
IVertex IVertexEnumerator.Current
|
1429
|
+
{
|
1430
|
+
get
|
1431
|
+
{
|
1432
|
+
return this.Current;
|
1433
|
+
}
|
1434
|
+
}
|
1435
|
+
Object IEnumerator.Current
|
1436
|
+
{
|
1437
|
+
get
|
1438
|
+
{
|
1439
|
+
return this.Current;
|
1440
|
+
}
|
1441
|
+
}
|
1442
|
+
public void Reset()
|
1443
|
+
{
|
1444
|
+
this.en.Reset();
|
1445
|
+
}
|
1446
|
+
public bool MoveNext()
|
1447
|
+
{
|
1448
|
+
return this.en.MoveNext();
|
1449
|
+
}
|
1450
|
+
}
|
1451
|
+
#endregion
|
1452
|
+
}
|
1453
|
+
#endregion
|
1454
|
+
|
1455
|
+
#region Edge Enumerable/Enumerator
|
1456
|
+
private class <%= VertexEdgesEdgeEnumerableType %> :
|
1457
|
+
IEdgeEnumerable
|
1458
|
+
{
|
1459
|
+
private IEnumerable en;
|
1460
|
+
public <%= VertexEdgesEdgeEnumerableType %>(IEnumerable en)
|
1461
|
+
{
|
1462
|
+
Debug.Assert(en!=null);
|
1463
|
+
this.en = en;
|
1464
|
+
}
|
1465
|
+
public IEdgeEnumerator GetEnumerator()
|
1466
|
+
{
|
1467
|
+
return new <%= VertexEdgesEdgeEnumeratorType %>(en);
|
1468
|
+
}
|
1469
|
+
IEnumerator IEnumerable.GetEnumerator()
|
1470
|
+
{
|
1471
|
+
return this.GetEnumerator();
|
1472
|
+
}
|
1473
|
+
|
1474
|
+
#region Edge Enumerator
|
1475
|
+
private class <%= VertexEdgesEdgeEnumeratorType %> :
|
1476
|
+
IEdgeEnumerator
|
1477
|
+
{
|
1478
|
+
private IEnumerator edges;
|
1479
|
+
private IEdgeEnumerator edge;
|
1480
|
+
|
1481
|
+
public <%= VertexEdgesEdgeEnumeratorType %>(IEnumerable en)
|
1482
|
+
{
|
1483
|
+
Debug.Assert(en!=null);
|
1484
|
+
this.edges = en.GetEnumerator();
|
1485
|
+
this.edge = null;
|
1486
|
+
}
|
1487
|
+
|
1488
|
+
public void Reset()
|
1489
|
+
{
|
1490
|
+
this.edges.Reset();
|
1491
|
+
this.edge=null;
|
1492
|
+
}
|
1493
|
+
|
1494
|
+
public bool MoveNext()
|
1495
|
+
{
|
1496
|
+
// check if first time.
|
1497
|
+
if (this.edge == null)
|
1498
|
+
{
|
1499
|
+
if (!moveNextVertex())
|
1500
|
+
return false;
|
1501
|
+
}
|
1502
|
+
|
1503
|
+
// getting next valid entry
|
1504
|
+
do
|
1505
|
+
{
|
1506
|
+
// try getting edge in the current out edge list
|
1507
|
+
if (edge.MoveNext())
|
1508
|
+
return true;
|
1509
|
+
|
1510
|
+
// move to the next outedge list
|
1511
|
+
if (!moveNextVertex())
|
1512
|
+
return false;
|
1513
|
+
}
|
1514
|
+
while(true);
|
1515
|
+
}
|
1516
|
+
|
1517
|
+
public <%= EdgeType %> Current
|
1518
|
+
{
|
1519
|
+
get
|
1520
|
+
{
|
1521
|
+
if (this.edge == null)
|
1522
|
+
throw new InvalidOperationException();
|
1523
|
+
return (<%= EdgeType %>)this.edge.Current;
|
1524
|
+
}
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
IEdge IEdgeEnumerator.Current
|
1528
|
+
{
|
1529
|
+
get
|
1530
|
+
{
|
1531
|
+
return this.Current;
|
1532
|
+
}
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
Object IEnumerator.Current
|
1536
|
+
{
|
1537
|
+
get
|
1538
|
+
{
|
1539
|
+
return this.Current;
|
1540
|
+
}
|
1541
|
+
}
|
1542
|
+
|
1543
|
+
private bool moveNextVertex()
|
1544
|
+
{
|
1545
|
+
// check if empty vertex set
|
1546
|
+
if (!this.edges.MoveNext())
|
1547
|
+
{
|
1548
|
+
this.edges=null;
|
1549
|
+
return false;
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
// getting enumerator
|
1553
|
+
this.edge = ((<%= EdgeCollectionType %>)this.edges.Current).GetEnumerator();
|
1554
|
+
return true;
|
1555
|
+
}
|
1556
|
+
}
|
1557
|
+
#endregion
|
1558
|
+
}
|
1559
|
+
#endregion
|
1560
|
+
}
|
1561
|
+
#endregion
|
1562
|
+
|
1563
|
+
#region <%= VertexEnumeratorType %>
|
1564
|
+
private class <%= VertexEnumeratorType %> : IVertexEnumerator
|
1565
|
+
{
|
1566
|
+
private IEnumerator en;
|
1567
|
+
public <%= VertexEnumeratorType %>(IEnumerable enumerable)
|
1568
|
+
{
|
1569
|
+
Debug.Assert(en!=null);
|
1570
|
+
this.en = enumerable.GetEnumerator();
|
1571
|
+
}
|
1572
|
+
|
1573
|
+
public void Reset()
|
1574
|
+
{
|
1575
|
+
this.en.Reset();
|
1576
|
+
}
|
1577
|
+
public bool MoveNext()
|
1578
|
+
{
|
1579
|
+
return this.en.MoveNext();
|
1580
|
+
}
|
1581
|
+
public <%= VertexType %> Current
|
1582
|
+
{
|
1583
|
+
get
|
1584
|
+
{
|
1585
|
+
return (<%= VertexType %>)this.en.Current;
|
1586
|
+
}
|
1587
|
+
}
|
1588
|
+
IVertex IVertexEnumerator.Current
|
1589
|
+
{
|
1590
|
+
get
|
1591
|
+
{
|
1592
|
+
return this.Current;
|
1593
|
+
}
|
1594
|
+
}
|
1595
|
+
Object IEnumerator.Current
|
1596
|
+
{
|
1597
|
+
get
|
1598
|
+
{
|
1599
|
+
return this.en.Current;
|
1600
|
+
}
|
1601
|
+
}
|
1602
|
+
}
|
1603
|
+
#endregion
|
1604
|
+
}
|
1605
|
+
}
|
1606
|
+
|
1607
|
+
<script runat="template">
|
1608
|
+
private String seeTag(string type)
|
1609
|
+
{
|
1610
|
+
return String.Format("<see cref=\"{0}\"/>",type);
|
1611
|
+
}
|
1612
|
+
public String ClassNameSee
|
1613
|
+
{
|
1614
|
+
get
|
1615
|
+
{
|
1616
|
+
return seeTag(this.ClassName);
|
1617
|
+
}
|
1618
|
+
}
|
1619
|
+
public String VertexTypeSee
|
1620
|
+
{
|
1621
|
+
get
|
1622
|
+
{
|
1623
|
+
return seeTag(this.VertexType);
|
1624
|
+
}
|
1625
|
+
}
|
1626
|
+
public String EdgeTypeSee
|
1627
|
+
{
|
1628
|
+
get
|
1629
|
+
{
|
1630
|
+
return seeTag(this.EdgeType);
|
1631
|
+
}
|
1632
|
+
}
|
1633
|
+
public string VertexProviderType
|
1634
|
+
{
|
1635
|
+
get
|
1636
|
+
{
|
1637
|
+
return this.VertexType + "Provider";
|
1638
|
+
}
|
1639
|
+
}
|
1640
|
+
public string EdgeProviderType
|
1641
|
+
{
|
1642
|
+
get
|
1643
|
+
{
|
1644
|
+
return this.EdgeType + "Provider";
|
1645
|
+
}
|
1646
|
+
}
|
1647
|
+
public string VertexEnumeratorType
|
1648
|
+
{
|
1649
|
+
get
|
1650
|
+
{
|
1651
|
+
return this.VertexType + "Enumerator";
|
1652
|
+
}
|
1653
|
+
}
|
1654
|
+
public string EdgeEnumeratorType
|
1655
|
+
{
|
1656
|
+
get
|
1657
|
+
{
|
1658
|
+
return this.EdgeType + "Enumerator";
|
1659
|
+
}
|
1660
|
+
}
|
1661
|
+
public string EdgeCollectionType
|
1662
|
+
{
|
1663
|
+
get
|
1664
|
+
{
|
1665
|
+
return this.EdgeType + "Collection";
|
1666
|
+
}
|
1667
|
+
}
|
1668
|
+
public string VertexEdgesDictionaryType
|
1669
|
+
{
|
1670
|
+
get
|
1671
|
+
{
|
1672
|
+
return this.VertexType + this.EdgeCollectionType + "Dictionary";
|
1673
|
+
}
|
1674
|
+
}
|
1675
|
+
public string VertexEdgesVertexEnumerableType
|
1676
|
+
{
|
1677
|
+
get
|
1678
|
+
{
|
1679
|
+
return this.VertexType + this.EdgeCollectionType + "VertexEnumerable";
|
1680
|
+
}
|
1681
|
+
}
|
1682
|
+
public string VertexEdgesVertexEnumeratorType
|
1683
|
+
{
|
1684
|
+
get
|
1685
|
+
{
|
1686
|
+
return this.VertexType + this.EdgeCollectionType + "VertexEnumerator";
|
1687
|
+
}
|
1688
|
+
}
|
1689
|
+
public string VertexEdgesEdgeEnumerableType
|
1690
|
+
{
|
1691
|
+
get
|
1692
|
+
{
|
1693
|
+
return this.VertexType + this.EdgeCollectionType + "EdgeEnumerable";
|
1694
|
+
}
|
1695
|
+
}
|
1696
|
+
public string VertexEdgesEdgeEnumeratorType
|
1697
|
+
{
|
1698
|
+
get
|
1699
|
+
{
|
1700
|
+
return this.VertexType + this.EdgeCollectionType + "EdgeEnumerator";
|
1701
|
+
}
|
1702
|
+
}
|
1703
|
+
</script>
|