Skip to main content
added 465 characters in body
Source Link
Kuba
  • 138.9k
  • 13
  • 297
  • 803

Can someone help me to make a clickable graph?

 Graph[{1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 2}] 

I found that VertexDelete removes desirable vertex and edges, but I don't know how to make it clickable and delete that vertex (and his edges) which was clicked by user.

I already have:

DynamicModule[ { selection = {} , gr = {1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 2} } , Dynamic[ Graph[gr , PlotLabel -> selection , VertexShapeFunction -> ( EventHandler[Disk[#1, .1] , "MouseClicked" :> (selection = #2; VertexDelete[gr, selection]; )] &) ] ] ] 

but it doesn't work

Can someone help me to make a clickable graph?

 Graph[{1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 2}] 

I found that VertexDelete removes desirable vertex and edges, but I don't know how to make it clickable and delete that vertex (and his edges) which was clicked by user.

Can someone help me to make a clickable graph?

 Graph[{1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 2}] 

I found that VertexDelete removes desirable vertex and edges, but I don't know how to make it clickable and delete that vertex (and his edges) which was clicked by user.

I already have:

DynamicModule[ { selection = {} , gr = {1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 2} } , Dynamic[ Graph[gr , PlotLabel -> selection , VertexShapeFunction -> ( EventHandler[Disk[#1, .1] , "MouseClicked" :> (selection = #2; VertexDelete[gr, selection]; )] &) ] ] ] 

but it doesn't work

added 2 characters in body; edited tags
Source Link
Kuba
  • 138.9k
  • 13
  • 297
  • 803

Can someone help me to make a clickable graph?

 Graph[{1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 2}] 

I found that VertexDeleteVertexDelete removes desirable vertex and edges, but I don't know how to make it clickable and delete that vertex (and his edges) which was clicked by user.

Can someone help me to make a clickable graph?

 Graph[{1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 2}] 

I found that VertexDelete removes desirable vertex and edges, but I don't know how to make it clickable and delete that vertex (and his edges) which was clicked by user.

Can someone help me to make a clickable graph?

 Graph[{1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 2}] 

I found that VertexDelete removes desirable vertex and edges, but I don't know how to make it clickable and delete that vertex (and his edges) which was clicked by user.

Source Link

Clickable graph

Can someone help me to make a clickable graph?

 Graph[{1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -> 2}] 

I found that VertexDelete removes desirable vertex and edges, but I don't know how to make it clickable and delete that vertex (and his edges) which was clicked by user.