Skip to content

Commit 4b33124

Browse files
committed
Merge pull request #11 from SimonTC/support_xml_serialization_of_undirected_graphs
Add support for xml serialization of undirected graphs. Fixes #10
2 parents 7cf6777 + f397d9b commit 4b33124

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/QuikGraph.Serialization/SerializationExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public static void SerializeToXml<TVertex, TEdge, TGraph>(
325325
[NotNull] string vertexElementName,
326326
[NotNull] string edgeElementName,
327327
[NotNull] string namespaceUri)
328-
where TGraph : IVertexAndEdgeListGraph<TVertex, TEdge>
328+
where TGraph : IEdgeListGraph<TVertex, TEdge>
329329
where TEdge : IEdge<TVertex>
330330
{
331331
SerializeToXml(
@@ -371,7 +371,7 @@ public static void SerializeToXml<TVertex, TEdge, TGraph>(
371371
[CanBeNull, InstantHandle] Action<XmlWriter, TGraph> writeGraphAttributes,
372372
[CanBeNull, InstantHandle] Action<XmlWriter, TVertex> writeVertexAttributes,
373373
[CanBeNull, InstantHandle] Action<XmlWriter, TEdge> writeEdgeAttributes)
374-
where TGraph : IVertexAndEdgeListGraph<TVertex, TEdge>
374+
where TGraph : IEdgeListGraph<TVertex, TEdge>
375375
where TEdge : IEdge<TVertex>
376376
{
377377
if (graph == null)

tests/QuikGraph.Serialization.Tests/XmlSerializationTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,13 @@ private static IEnumerable<TestCaseData> XmlSerializationGraphTestCases
9898
{
9999
yield return new TestCaseData(new AdjacencyGraph<Person, TaggedEdge<Person, string>>());
100100
yield return new TestCaseData(new BidirectionalGraph<Person, TaggedEdge<Person, string>>());
101+
yield return new TestCaseData(new UndirectedGraph<Person, TaggedEdge<Person, string>>());
101102
}
102103
}
103104

104105
[TestCaseSource(nameof(XmlSerializationGraphTestCases))]
105106
public void SerializeToXml<TGraph>([NotNull] TGraph graph)
106-
where TGraph
107-
: IVertexAndEdgeListGraph<Person, TaggedEdge<Person, string>>
108-
, IMutableVertexAndEdgeSet<Person, TaggedEdge<Person, string>>
107+
where TGraph: IMutableVertexAndEdgeSet<Person, TaggedEdge<Person, string>>
109108
{
110109
var persons = new List<Person>();
111110
var jacob = new Person("Jacob", "Hochstetler")

0 commit comments

Comments
 (0)