Skip to content

Commit

Permalink
temporary migration fix for #17
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Dieckmann committed Feb 7, 2016
1 parent 1321183 commit b33c554
Show file tree
Hide file tree
Showing 6 changed files with 384 additions and 0 deletions.
69 changes: 69 additions & 0 deletions nodes/0.8.x/PathGraph.AllPaths.dyf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<Workspace Version="0.8.2.2392" X="-411.972474511132" Y="-18.6450055624579" zoom="0.852765925581497" Name="PathGraph.AllPaths" Description="Finds all possible paths between two nodes. The connections input expects a list of value pairs." ID="d999fe4a-b7e7-4c74-8184-19f824d6b487" Category="Clockwork.Core.Graphs.Query">
<NamespaceResolutionMap />
<Elements>
<DSIronPythonNode.PythonNode guid="da920ed9-abbc-4162-98e3-760a71672a85" type="DSIronPythonNode.PythonNode" nickname="Python Script" x="1128.36610510175" y="420.614930763983" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" inputcount="3">
<Script>pathgraphlist = IN[0]
start = IN[1]
end = IN[2]
pathgraph = dict()

for item in pathgraphlist:
pathgraph[item[0]] = item[1]

# script found here:
# https://www.python.org/doc/essays/graphs/

def find_all_paths(graph, start, end, path=[]):
path = path + [start]
if start == end:
return [path]
if not graph.has_key(start):
return []
paths = []
for node in graph[start]:
if node not in path:
newpaths = find_all_paths(graph, node, end, path)
for newpath in newpaths:
paths.append(newpath)
return paths

OUT = find_all_paths(pathgraph,start,end)</Script>
</DSIronPythonNode.PythonNode>
<Dynamo.Nodes.Symbol guid="332a1e14-a461-4039-a7a6-63aed8204339" type="Dynamo.Nodes.Symbol" nickname="Input" x="898.663779383415" y="447.719539377912" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True">
<Symbol value="start : string" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.Symbol guid="23cfa896-f741-416d-a6d2-e69688917c85" type="Dynamo.Nodes.Symbol" nickname="Input" x="914.390326727789" y="525.006935262526" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True">
<Symbol value="end : string" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.Symbol guid="b936549c-250c-4b62-9c5e-70ce210f8b66" type="Dynamo.Nodes.Symbol" nickname="Input" x="576.970973625251" y="367.547653121264" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True">
<Symbol value="stringPairs : string[][]" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.Output guid="0d72d3c7-a780-4904-ae98-9b0dfd051fc1" type="Dynamo.Nodes.Output" nickname="Output" x="1329.05395725147" y="420.27511792262" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False">
<Symbol value="paths" />
</Dynamo.Nodes.Output>
<Dynamo.Nodes.Function guid="c497b32a-adb7-4bde-bd9a-19a6a76dcc9e" type="Dynamo.Nodes.Function" nickname="PathGraph.ByPairs" x="855.681330671609" y="368.059280499843" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False">
<ID value="e671caea-80d8-4245-8bf3-72144e19e559" />
<Name value="PathGraph.ByPairs" />
<Description value="Builds a path graph (Python dictionary) from a list of value pairs." />
<Inputs>
<Input value="stringPairs" />
</Inputs>
<Outputs>
<Output value="pathGraph" />
</Outputs>
</Dynamo.Nodes.Function>
</Elements>
<Connectors>
<Dynamo.Models.ConnectorModel start="da920ed9-abbc-4162-98e3-760a71672a85" start_index="0" end="0d72d3c7-a780-4904-ae98-9b0dfd051fc1" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="332a1e14-a461-4039-a7a6-63aed8204339" start_index="0" end="da920ed9-abbc-4162-98e3-760a71672a85" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="23cfa896-f741-416d-a6d2-e69688917c85" start_index="0" end="da920ed9-abbc-4162-98e3-760a71672a85" end_index="2" portType="0" />
<Dynamo.Models.ConnectorModel start="b936549c-250c-4b62-9c5e-70ce210f8b66" start_index="0" end="c497b32a-adb7-4bde-bd9a-19a6a76dcc9e" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="c497b32a-adb7-4bde-bd9a-19a6a76dcc9e" start_index="0" end="da920ed9-abbc-4162-98e3-760a71672a85" end_index="0" portType="0" />
</Connectors>
<Notes />
<Annotations />
<Presets />
<Cameras>
<Camera Name="background_preview" eyeX="10" eyeY="15" eyeZ="10" lookX="-10" lookY="-10" lookZ="-10" />
</Cameras>
</Workspace>
53 changes: 53 additions & 0 deletions nodes/0.8.x/PathGraph.ByPairs.dyf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<Workspace Version="0.8.2.2392" X="-34.468808553869" Y="-51.1231535101859" zoom="1.00646868784672" Name="PathGraph.ByPairs" Description="Builds a path graph (Python dictionary) from a list of value pairs." ID="e671caea-80d8-4245-8bf3-72144e19e559" Category="Clockwork.Core.Graphs.Create">
<NamespaceResolutionMap />
<Elements>
<DSCore.Map guid="a1d37bd1-4aa7-4237-b1cc-d7175981e319" type="DSCore.Map" nickname="List.Map" x="452.700190848577" y="413.104666571368" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" />
<Dynamo.Nodes.DSVarArgFunction guid="4ba7b4bc-1b3a-409b-bf02-c545cc3f9070" type="Dynamo.Nodes.DSVarArgFunction" nickname="List.Join" x="670.004916832784" y="351.760869710711" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" assembly="DSCoreNodes.dll" function="DSCore.List.Join@var[]..[]" inputcount="2" />
<Dynamo.Nodes.DSFunction guid="a6a1d23a-4c63-4ae6-a15b-63395a4b4b67" type="Dynamo.Nodes.DSFunction" nickname="List.Reverse" x="302.825006943128" y="438.675763331531" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" assembly="DSCoreNodes.dll" function="DSCore.List.Reverse@var[]..[]" />
<Dynamo.Nodes.Symbol guid="b936549c-250c-4b62-9c5e-70ce210f8b66" type="Dynamo.Nodes.Symbol" nickname="Input" x="177.221372013558" y="352.303141573579" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True">
<Symbol value="stringPairs : string[][]" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.Output guid="0d72d3c7-a780-4904-ae98-9b0dfd051fc1" type="Dynamo.Nodes.Output" nickname="Output" x="1029.70191789076" y="276.190531984241" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False">
<Symbol value="pathGraph" />
</Dynamo.Nodes.Output>
<DSIronPythonNode.PythonNode guid="9deaff79-36b8-4a83-82de-55963e7047fd" type="DSIronPythonNode.PythonNode" nickname="Python Script" x="842.082276287975" y="275.241581330473" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" inputcount="2">
<Script>indices = IN[0]
flatlist = IN[1]
pathgraph = dict()

# script found here:
# https://www.python.org/doc/essays/graphs/

for index in indices:
indexlist = list()
for item in flatlist:
if index == item[0]:
indexlist.append(item[1])
pathgraph[index] = indexlist
# convert dictionary to list as Dynamo does not allow Python dictionaries
OUT = pathgraph.items()</Script>
</DSIronPythonNode.PythonNode>
<Dynamo.Nodes.DSFunction guid="9fee1661-047b-4d01-b99f-6c4b7ef16a8c" type="Dynamo.Nodes.DSFunction" nickname="List.UniqueItems" x="661.558206191576" y="216.184851732469" isVisible="true" isUpstreamVisible="true" lacing="Shortest" isSelectedInput="False" assembly="DSCoreNodes.dll" function="DSCore.List.UniqueItems@var[]..[]" />
<Dynamo.Nodes.DSFunction guid="25bc4a3a-00e7-437d-8541-55402b5f2fab" type="Dynamo.Nodes.DSFunction" nickname="Flatten" x="491.234511310881" y="214.895349746426" isVisible="true" isUpstreamVisible="true" lacing="Shortest" isSelectedInput="False" assembly="BuiltIn" function="Flatten@var[]..[]" />
</Elements>
<Connectors>
<Dynamo.Models.ConnectorModel start="a1d37bd1-4aa7-4237-b1cc-d7175981e319" start_index="0" end="4ba7b4bc-1b3a-409b-bf02-c545cc3f9070" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="4ba7b4bc-1b3a-409b-bf02-c545cc3f9070" start_index="0" end="9deaff79-36b8-4a83-82de-55963e7047fd" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="a6a1d23a-4c63-4ae6-a15b-63395a4b4b67" start_index="0" end="a1d37bd1-4aa7-4237-b1cc-d7175981e319" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="b936549c-250c-4b62-9c5e-70ce210f8b66" start_index="0" end="a1d37bd1-4aa7-4237-b1cc-d7175981e319" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="b936549c-250c-4b62-9c5e-70ce210f8b66" start_index="0" end="4ba7b4bc-1b3a-409b-bf02-c545cc3f9070" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="b936549c-250c-4b62-9c5e-70ce210f8b66" start_index="0" end="25bc4a3a-00e7-437d-8541-55402b5f2fab" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="9deaff79-36b8-4a83-82de-55963e7047fd" start_index="0" end="0d72d3c7-a780-4904-ae98-9b0dfd051fc1" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="9fee1661-047b-4d01-b99f-6c4b7ef16a8c" start_index="0" end="9deaff79-36b8-4a83-82de-55963e7047fd" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="25bc4a3a-00e7-437d-8541-55402b5f2fab" start_index="0" end="9fee1661-047b-4d01-b99f-6c4b7ef16a8c" end_index="0" portType="0" />
</Connectors>
<Notes>
<Dynamo.Models.NoteModel guid="9f47b863-58d4-42fc-9265-38a0ac817f62" text="Get a flat list of paths" x="628.75258171903" y="452.141498341382" />
<Dynamo.Models.NoteModel guid="75c3ad21-94ba-4fb2-9b1f-6c9f80e97031" text="Get a list of distinct indices" x="560.074994282151" y="174.015254071869" />
</Notes>
<Annotations />
<Presets />
<Cameras>
<Camera Name="background_preview" eyeX="10" eyeY="15" eyeZ="10" lookX="-10" lookY="-10" lookZ="-10" />
</Cameras>
</Workspace>
70 changes: 70 additions & 0 deletions nodes/0.8.x/PathGraph.ShortestPath.dyf
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<Workspace Version="0.8.2.2392" X="30" Y="262.902665121669" zoom="1.52143684820394" Name="PathGraph.ShortestPath" Description="Finds the shortest path (fewest steps) between two nodes. The connections input expects a list of value pairs." ID="24d4b1c8-ad48-4f6f-939d-a6d4e0d25a0c" Category="Clockwork.Core.Graphs.Query">
<NamespaceResolutionMap />
<Elements>
<DSIronPythonNode.PythonNode guid="da920ed9-abbc-4162-98e3-760a71672a85" type="DSIronPythonNode.PythonNode" nickname="Python Script" x="568" y="57" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" inputcount="3">
<Script>pathgraphlist = IN[0]
start = IN[1]
end = IN[2]
pathgraph = dict()

for item in pathgraphlist:
pathgraph[item[0]] = item[1]

# script found here:
# https://www.python.org/doc/essays/graphs/

def find_shortest_path(graph, start, end, path=[]):
path = path + [start]
if start == end:
return path
if not graph.has_key(start):
return None
shortest = None
for node in graph[start]:
if node not in path:
newpath = find_shortest_path(graph, node, end, path)
if newpath:
if not shortest or len(newpath) &lt; len(shortest):
shortest = newpath
return shortest

OUT = find_shortest_path(pathgraph,start,end)</Script>
</DSIronPythonNode.PythonNode>
<Dynamo.Nodes.Symbol guid="332a1e14-a461-4039-a7a6-63aed8204339" type="Dynamo.Nodes.Symbol" nickname="Input" x="320.092155369383" y="86.2863670982483" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True">
<Symbol value="start : string" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.Symbol guid="23cfa896-f741-416d-a6d2-e69688917c85" type="Dynamo.Nodes.Symbol" nickname="Input" x="337.181264280274" y="171.258187357197" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True">
<Symbol value="end : string" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.Symbol guid="b936549c-250c-4b62-9c5e-70ce210f8b66" type="Dynamo.Nodes.Symbol" nickname="Input" x="-28.9200304645849" y="0" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True">
<Symbol value="stringPairs : string[][]" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.Output guid="0d72d3c7-a780-4904-ae98-9b0dfd051fc1" type="Dynamo.Nodes.Output" nickname="Output" x="792" y="57" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False">
<Symbol value="paths" />
</Dynamo.Nodes.Output>
<Dynamo.Nodes.Function guid="c497b32a-adb7-4bde-bd9a-19a6a76dcc9e" type="Dynamo.Nodes.Function" nickname="PathGraph.ByPairs" x="275.314546839299" y="-0.182787509520182" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False">
<ID value="e671caea-80d8-4245-8bf3-72144e19e559" />
<Name value="PathGraph.ByPairs" />
<Description value="Builds a path graph (Python dictionary) from a list of value pairs." />
<Inputs>
<Input value="stringPairs" />
</Inputs>
<Outputs>
<Output value="pathGraph" />
</Outputs>
</Dynamo.Nodes.Function>
</Elements>
<Connectors>
<Dynamo.Models.ConnectorModel start="da920ed9-abbc-4162-98e3-760a71672a85" start_index="0" end="0d72d3c7-a780-4904-ae98-9b0dfd051fc1" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="332a1e14-a461-4039-a7a6-63aed8204339" start_index="0" end="da920ed9-abbc-4162-98e3-760a71672a85" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="23cfa896-f741-416d-a6d2-e69688917c85" start_index="0" end="da920ed9-abbc-4162-98e3-760a71672a85" end_index="2" portType="0" />
<Dynamo.Models.ConnectorModel start="b936549c-250c-4b62-9c5e-70ce210f8b66" start_index="0" end="c497b32a-adb7-4bde-bd9a-19a6a76dcc9e" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="c497b32a-adb7-4bde-bd9a-19a6a76dcc9e" start_index="0" end="da920ed9-abbc-4162-98e3-760a71672a85" end_index="0" portType="0" />
</Connectors>
<Notes />
<Annotations />
<Presets />
<Cameras>
<Camera Name="background_preview" eyeX="10" eyeY="15" eyeZ="10" lookX="-10" lookY="-10" lookZ="-10" />
</Cameras>
</Workspace>
69 changes: 69 additions & 0 deletions nodes/0.9.x/PathGraph.AllPaths.dyf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<Workspace Version="0.8.2.2392" X="-411.972474511132" Y="-18.6450055624579" zoom="0.852765925581497" Name="PathGraph.AllPaths" Description="Finds all possible paths between two nodes. The connections input expects a list of value pairs." ID="d999fe4a-b7e7-4c74-8184-19f824d6b487" Category="Clockwork.Core.Graphs.Query">
<NamespaceResolutionMap />
<Elements>
<DSIronPythonNode.PythonNode guid="da920ed9-abbc-4162-98e3-760a71672a85" type="DSIronPythonNode.PythonNode" nickname="Python Script" x="1128.36610510175" y="420.614930763983" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" inputcount="3">
<Script>pathgraphlist = IN[0]
start = IN[1]
end = IN[2]
pathgraph = dict()

for item in pathgraphlist:
pathgraph[item[0]] = item[1]

# script found here:
# https://www.python.org/doc/essays/graphs/

def find_all_paths(graph, start, end, path=[]):
path = path + [start]
if start == end:
return [path]
if not graph.has_key(start):
return []
paths = []
for node in graph[start]:
if node not in path:
newpaths = find_all_paths(graph, node, end, path)
for newpath in newpaths:
paths.append(newpath)
return paths

OUT = find_all_paths(pathgraph,start,end)</Script>
</DSIronPythonNode.PythonNode>
<Dynamo.Nodes.Symbol guid="332a1e14-a461-4039-a7a6-63aed8204339" type="Dynamo.Nodes.Symbol" nickname="Input" x="898.663779383415" y="447.719539377912" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True">
<Symbol value="start : string" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.Symbol guid="23cfa896-f741-416d-a6d2-e69688917c85" type="Dynamo.Nodes.Symbol" nickname="Input" x="914.390326727789" y="525.006935262526" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True">
<Symbol value="end : string" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.Symbol guid="b936549c-250c-4b62-9c5e-70ce210f8b66" type="Dynamo.Nodes.Symbol" nickname="Input" x="576.970973625251" y="367.547653121264" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True">
<Symbol value="stringPairs : string[][]" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.Output guid="0d72d3c7-a780-4904-ae98-9b0dfd051fc1" type="Dynamo.Nodes.Output" nickname="Output" x="1329.05395725147" y="420.27511792262" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False">
<Symbol value="paths" />
</Dynamo.Nodes.Output>
<Dynamo.Nodes.Function guid="c497b32a-adb7-4bde-bd9a-19a6a76dcc9e" type="Dynamo.Nodes.Function" nickname="PathGraph.ByPairs" x="855.681330671609" y="368.059280499843" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False">
<ID value="e671caea-80d8-4245-8bf3-72144e19e559" />
<Name value="PathGraph.ByPairs" />
<Description value="Builds a path graph (Python dictionary) from a list of value pairs." />
<Inputs>
<Input value="stringPairs" />
</Inputs>
<Outputs>
<Output value="pathGraph" />
</Outputs>
</Dynamo.Nodes.Function>
</Elements>
<Connectors>
<Dynamo.Models.ConnectorModel start="da920ed9-abbc-4162-98e3-760a71672a85" start_index="0" end="0d72d3c7-a780-4904-ae98-9b0dfd051fc1" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="332a1e14-a461-4039-a7a6-63aed8204339" start_index="0" end="da920ed9-abbc-4162-98e3-760a71672a85" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="23cfa896-f741-416d-a6d2-e69688917c85" start_index="0" end="da920ed9-abbc-4162-98e3-760a71672a85" end_index="2" portType="0" />
<Dynamo.Models.ConnectorModel start="b936549c-250c-4b62-9c5e-70ce210f8b66" start_index="0" end="c497b32a-adb7-4bde-bd9a-19a6a76dcc9e" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="c497b32a-adb7-4bde-bd9a-19a6a76dcc9e" start_index="0" end="da920ed9-abbc-4162-98e3-760a71672a85" end_index="0" portType="0" />
</Connectors>
<Notes />
<Annotations />
<Presets />
<Cameras>
<Camera Name="background_preview" eyeX="10" eyeY="15" eyeZ="10" lookX="-10" lookY="-10" lookZ="-10" />
</Cameras>
</Workspace>
Loading

0 comments on commit b33c554

Please sign in to comment.