-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ending flow at two different points #92
Comments
Hi David, the quick answer is that no, flows only end at ProcessGroups, not Waypoints -- by definition a Waypoint is in the middle of a flow/bundle. Maybe if you can give a sketch of what you want it to look like I can help? |
I see. I have 12 columns and I need flows to end at each of the columns
essentially. I can make all flows that (eventually) end, end at some
waypoint but not at different waypoints. Is it possible to make 12
processgroups? I could only seem to make process groups from columns named
source or target.
Thank you so much for your response ✌
…On Thu, Jan 23, 2020 at 11:25 AM Rick Lupton ***@***.***> wrote:
Hi David, the quick answer is that no, flows only end at ProcessGroups,
not Waypoints -- by definition a Waypoint is in the middle of a flow/bundle.
Maybe if you can give a sketch of what you want it to look like I can help?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#92?email_source=notifications&email_token=AMDGQGLEMTUXXP3JOFRM3ETQ7HAG7A5CNFSM4KJVTTL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJX6D4Q#issuecomment-577757682>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMDGQGJQC2KAVNNQHNC3YN3Q7HAG7ANCNFSM4KJVTTLQ>
.
|
(You can make all the nodes end in waypoint n by adding the bundle :
…On Thu, Jan 23, 2020 at 11:35 AM David Reiss ***@***.***> wrote:
I see. I have 12 columns and I need flows to end at each of the columns
essentially. I can make all flows that (eventually) end, end at some
waypoint but not at different waypoints. Is it possible to make 12
processgroups? I could only seem to make process groups from columns named
source or target.
Thank you so much for your response ✌
On Thu, Jan 23, 2020 at 11:25 AM Rick Lupton ***@***.***>
wrote:
> Hi David, the quick answer is that no, flows only end at ProcessGroups,
> not Waypoints -- by definition a Waypoint is in the middle of a flow/bundle.
>
> Maybe if you can give a sketch of what you want it to look like I can
> help?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#92?email_source=notifications&email_token=AMDGQGLEMTUXXP3JOFRM3ETQ7HAG7A5CNFSM4KJVTTL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJX6D4Q#issuecomment-577757682>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AMDGQGJQC2KAVNNQHNC3YN3Q7HAG7ANCNFSM4KJVTTLQ>
> .
>
|
You can make all the flows end in waypoint N by adding the bundle:
Bundle('move1', Elsewhere, waypoints=['waypoint2', ... , 'waypointN',])
…On Thu, Jan 23, 2020 at 11:35 AM David Reiss ***@***.***> wrote:
I see. I have 12 columns and I need flows to end at each of the columns
essentially. I can make all flows that (eventually) end, end at some
waypoint but not at different waypoints. Is it possible to make 12
processgroups? I could only seem to make process groups from columns named
source or target.
Thank you so much for your response ✌
On Thu, Jan 23, 2020 at 11:25 AM Rick Lupton ***@***.***>
wrote:
> Hi David, the quick answer is that no, flows only end at ProcessGroups,
> not Waypoints -- by definition a Waypoint is in the middle of a flow/bundle.
>
> Maybe if you can give a sketch of what you want it to look like I can
> help?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#92?email_source=notifications&email_token=AMDGQGLEMTUXXP3JOFRM3ETQ7HAG7A5CNFSM4KJVTTL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJX6D4Q#issuecomment-577757682>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AMDGQGJQC2KAVNNQHNC3YN3Q7HAG7ANCNFSM4KJVTTLQ>
> .
>
|
With the data setup the way you have it in your example it is possible -- but better to change the data as I show below if possible. You can get what I think you want by adding two Bundles like this: bundles = [
Bundle('move1', 'move4', waypoints=['waypoint1', 'waypoint2']),
Bundle('move1', Elsewhere, waypoints=['waypoint1'], flow_selection='x3rd != x3rd'),
Bundle('move1', Elsewhere, waypoints=['waypoint1', 'waypoint2'], flow_selection='x3rd == x3rd'),
] (note I added an The difficulty is that in your original code, all the flows with Really, the solution would be to set the df = pd.DataFrame(columns=['source', 'target', 'x2nd','x3rd','x4th', 'x5th', 'x6th', 'value'])
df['source']=['X','X','X','B','B','B', 'B']
df['x3rd'] = ['XBR1', 'XX T B', 'XX T X', 'BR1F', 'BR2C', 'BR2C',None ]#'BR2C']
df['x2nd'] = ['XB','XX','XX','BR1','BR2', 'BR2','BF']
df['target'] = ['XBR1C', 'XX T BC', 'XX T XB1','stop1' , 'BR2C R', 'BR2C R', 'stop2']
df['value']=[1,1,1,1,1, 1, 1]
pdict = {}
pdict[1] = ['B', 'X']
pdict[2] = sorted(list(set(df['x2nd'])))
pdict3list = list(set(df['x3rd']))
pdict3list.remove(None)
pdict[3] = sorted(pdict3list)
pdict[4] = ['BR2C R', 'XBR1C', 'XX T BC', 'XX T XB1']
part1 = Partition.Simple('process', ['B','X'])
part4 = Partition.Simple('process', pdict[4])
part3 = Partition.Simple('x3rd', pdict[3])
part2 = Partition.Simple('x2nd', pdict[2])
nodes = {
'move1': ProcessGroup(pdict[1], partition = part1),
'move4': ProcessGroup(pdict[4], partition = part4),
'stop1': ProcessGroup(['stop1']),
'stop2': ProcessGroup(['stop2']),
'waypoint1': Waypoint(part2),
'waypoint2': Waypoint(part3)
}
ordering = [
[[], ['move1']],
[['stop1'], ['waypoint1']],
[['stop2'], ['waypoint2']],
[[], ['move4']],
]
bundles = [
Bundle('move1', 'move4', waypoints=['waypoint1', 'waypoint2']),
Bundle('move1', 'stop1', waypoints=[]),
Bundle('move1', 'stop2', waypoints=['waypoint1']),
]
sdd = SankeyDefinition(nodes, bundles, ordering, flow_partition=part3)
size = dict(width=600, height=600)
weave(sdd, df).to_widget(debugging=True, **size) |
I have two places where I want the flow to end, one is after 'BF' at the first waypoint, the second is after 'BR1F' at the second waypoint. This code will only get them both to end at the second waypoint.
(The reason I am using a dict for my partition is so that I can remove the 'None' and then sort the list).
I thought since None doesn't appear in the partitions that it wouldn't appear in the second waypoint, but it seems that every flow must continue to every waypoint.
To summarize, I'd like to end a flow at each waypoint and I don't know how to do that.
Also, I don't know how to make more than 2 'process groups'. Is it possible to have bundles that go from col1 to col2 and from col2 to col3? My process groups seem to have to have column names that are 'source' and 'target' so I'm not sure how to get a third one. If I could, perhaps I could just make these process groups with bundles and not have to use waypoints at all.
Thanks for the help.
df = pd.DataFrame(columns=['source', 'target', '2nd','3rd','4th', '5th', '6th', 'value'])
df['source']=['X','X','X','B','B','B', 'B']
df['3rd'] = ['XBR1', 'XX T B', 'XX T X', 'BR1F', 'BR2C', 'BR2C',None ]#'BR2C']
df['2nd'] = ['XB','XX','XX','BR1','BR2', 'BR2','BF']
df['target'] = ['XBR1C', 'XX T BC', 'XX T XB1',None , 'BR2C R', 'BR2C R', None]
df['value']=[1,1,1,1,1, 1, 1]
pdict = {}
pdict[1] = ['B', 'X']
pdict[2] = sorted(list(set(df['2nd'])))
pdict3list = list(set(df['3rd']))
pdict3list.remove(None)
pdict[3] = sorted(pdict3list)
pdict4list = list(set(df['target']))
pdict4list.remove(None)
pdict[4] = sorted(pdict4list)
nodes = {
'move1': ProcessGroup(pdict[1]),
'move4': ProcessGroup(pdict[4]),
}
part1 = Partition.Simple('process', ['B','X'])
part4 = Partition.Simple('process', pdict[4])
part3 = Partition.Simple('3rd', pdict[3])
part2 = Partition.Simple('2nd', pdict[2])
nodes['move1'].partition = part1
nodes['move4'].partition = part4
nodes['waypoint1'] = Waypoint(part2)
nodes['waypoint2'] = Waypoint(part3)
ordering = [
['move1'],
['waypoint1'],
['waypoint2'],
['move4']
]
bundles = [
Bundle('move1', 'move4', waypoints=['waypoint1', 'waypoint2']),
Bundle('move1', Elsewhere, waypoints=['waypoint1', 'waypoint2']),
]
Update the SDD with the new nodes, ordering & bundles.
sdd = SankeyDefinition(nodes, bundles, ordering, flow_partition=part3)
size = dict(width=600, height=600)
weave(sdd, df).to_widget(**size)
The text was updated successfully, but these errors were encountered: