Deserializing\Serializing Custom Vertices

Topics: graph, serialization
Jun 16, 2015 at 6:51 PM
Hi,
I have a custom Vertex
Class PocVertex
{
       [XmlAttribute("member1")]
        public string member1
        
        [XmlAttribute("member2")]
        public string  member2
        ''
        ''
        [XmlAttribute("member10")]
         public string member10
}

public class POCEdge<TVertex> : Edge<TVertex>
    {
        [XmlAttribute("Tag")]
        public string Tag { get; set; }

        public SysEdge(TVertex source, TVertex target)
            : base(source, target) { }

        public SysEdge(TVertex source, TVertex target, string tag)
            : this(source, target)
        {
            Tag = tag;
        }
    }
I am having trouble deserializing, here is my code
AdjacencyGraph<POCVertex, POCEdge<POCVertex>> deserializedGraph 
                                    = new AdjacencyGraph<POCVertex, POCEdge<POCVertex>>();

XmlReader xreader = XmlReader.Create(XMLPath);
                IdentifiableVertexFactory<POCVertex> vertexFactory = new IdentifiableVertexFactory<POCVertex>();
                IdentifiableEdgeFactory<POCVertex, POCEdge<POCVertex>> edgeFactory;

                GraphMLExtensions.DeserializeFromGraphML<POCVertex, POCEdge<POCVertex>,
                    AdjacencyGraph<POCVertex, POCEdge<POCVertex>>>(deserializedGraph, xreader, vertexFactory, edgeFactory);
Can you please explain what does "IdentifiableVertexFactory" and "IdentifiableEdgeFactory" do, how should I use them here?
Jun 17, 2015 at 12:50 AM
Hi, if i remember correctly factories should implement methods to generate vertex and edge classes you use. Create custom factory classes for vertices and edges and use them in Deserialize method.
Jun 17, 2015 at 8:18 AM
Thanks, I got that resolved. Also, while using custom vertex and edges, do I need implement "IEqualityComparer" in order to use functions like
graph.TryGetOutEdges() and "HoffmanPavleyRankedShortestPathAlgorithm"?
Jun 17, 2015 at 4:35 PM
Also,
  What would be the best approach to update node\vertex.
Example : If I update a member of Vertex custom class.
Can you please suggest?
Jun 29, 2015 at 12:14 PM
I'm not a big expert in Quickgraph, you can look in the sources for method implementations to see what they use.

Not sure what you mean by updating, you just select vertex from the list and update data in it. If you need to use new data in calculations you just call corresponding method to regenerate results.