Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • graph-tool graph-tool
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 53
    • Issues 53
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Admin message

Please use the issue tracker only to report bugs (i.e. errors in the library that need to be fixed) or feature requests.

For questions about how to compile, install or use the library, please use instead the web forum at https://forum.skewed.de/c/graph-tool.


(If unsure, use the forum first.)


IMPORTANT: When opening new issues, please choose the BUG template from the drop-down menu, and fill out the required information.

  • Tiago Peixoto
  • graph-toolgraph-tool
  • Issues
  • #258
Closed
Open
Issue created Dec 17, 2015 by Joseph@Hickey

Error using graph_tool.util.find_vertex with prop="in"

Hi,

I would like to use graph_tool.util.find_vertex to find vertices with a specified in-degree. I am able to find vertices with a specified vertex property, but it does not work when I set the parameter prop to a string value (e.g. "in"). The sample code below shows my problem:

from graph_tool.all import *

#Create graph
g = Graph()

#Add two vertices and an edge between them
g.add_vertex(2)
g.add_edge(0,1)

#Define vertex property and decorate vertices with this property
vprop1 = g.new_vertex_property("string")
vprop1[g.vertex(0)]="vertex 0"
vprop1[g.vertex(1)]="vertex 1"

#Call find_vertex with prop parameter as a PropertyMap
x1 = graph_tool.util.find_vertex(g, vprop1, "vertex 0")
#Call find_vertex with prop parameter set to "in"
x2 = graph_tool.util.find_vertex(g, "in", 1)

Output: The variable x1 comes out fine, but I receive the following error for x2:

AttributeError                            Traceback (most recent call last)
<ipython-input-22-99bf38daf7cf> in <module>()
----> 1 x2 = graph_tool.util.find_vertex(g, "in", 1)

/usr/lib/python2.7/dist-packages/graph_tool/util/__init__.pyc in find_vertex(g, prop, match)
     52     can be either a :class:`~graph_tool.PropertyMap` or string with value "in",
     53     "out" or "total", representing a degree type."""
---> 54     val = _converter(prop.value_type())(match)
     55     ret = libgraph_tool_util.\
     56           find_vertex_range(g._Graph__graph, _degree(g, prop),

AttributeError: 'str' object has no attribute 'value_type'
Assignee
Assign to
Time tracking