[vtkusers] Infovis: Use calculator on graphs?

Eric E. Monson emonson at cs.duke.edu
Wed Dec 3 10:07:14 EST 2008


I forgot to mention, that when I run this code I get:

ERROR: In /Users/emonson/Programming/VTK_cvs/VTK/Filtering/ 
vtkExecutive.cxx, line 757
vtkStreamingDemandDrivenPipeline (0x894300): Algorithm  
vtkArrayCalculator(0x894240) returned failure for request:  
vtkInformation (0x8944d0)
   Debug: Off
   Modified Time: 319
   Reference Count: 1
   Registered Events: (none)
   Request: REQUEST_DATA_OBJECT
   FORWARD_DIRECTION: 0
   ALGORITHM_AFTER_FORWARD: 1
   FROM_OUTPUT_PORT: 0


On Dec 3, 2008, at 9:52 AM, Eric E. Monson wrote:

> Hey,
>
> I've been having trouble using the vtkArrayCalculator on a  
> vtkUndirectedGraph. From the options (like UseVertexData) it looks  
> like it should work, but I can't tell if there's a problem or if I'm  
> just doing something wrong.
>
> Here's my test code that starts like Examples/Infovis/Python/ 
> boost_centrality.py -- can anyone see something silly I'm doing?  
> (CVS VTK, OS X 10.5.5, Python 2.5)
>
> # ===================
> import vtk
>
> source = vtk.vtkRandomGraphSource()
> source.DirectedOff()
> source.SetNumberOfVertices(50)
> source.SetEdgeProbability(0.01)
> source.SetUseEdgeProbability(True)
> source.AllowParallelEdgesOn()
> source.AllowSelfLoopsOn()
> source.SetStartWithTree(True)
>
> # Connect to the Boost centrality filter.
> centrality = vtk.vtkBoostBrandesCentrality ()
> centrality.SetInputConnection(source.GetOutputPort())
> centrality.Update()
> centrality 
> .GetOutputDataObject(0).GetVertexData().SetActiveScalars('centrality')
>
> # Rescale the graph vertex scalars
> calc = vtk.vtkArrayCalculator()
> calc.SetInputConnection(centrality.GetOutputPort())
> calc.SetAttributeModeToUseVertexData()
> calc.AddScalarArrayName("centrality", 0)
> calc.SetFunction("centrality / 100.0")
> calc.SetResultArrayName("centScaled")
> calc.Update()
>
> # =================
>
> Thanks,
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list