Skip to content

gravis is not working with a subclass derived from a valid graph #8

@lnajman

Description

@lnajman

Here is a minimal example:

The following is working:

import igraph as ig
import gravis as gv

lnames = ['0', '1']
edgelist = [('0', '1')]
graph = ig.Graph(len(lnames),  vertex_attrs={'name': lnames})
graph.add_edges(edgelist)
gv.vis(graph)

The following is not:

class mygraph(ig.Graph):
  def __init__(self, lnames, edgelist):
    super().__init__(len(lnames), vertex_attrs={'name': lnames})
    self.add_edges(edgelist)

graph = mygraph(lnames, edgelist)
gv.vis(graph)

This returns

ValueError: The provided data seems not to be in a valid graph format.

Is there a workaround?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions