Skip to content
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

Edge slicing #372

Merged
merged 30 commits into from
Mar 9, 2022
Merged

Edge slicing #372

merged 30 commits into from
Mar 9, 2022

Conversation

gotdairyya
Copy link
Contributor

@gotdairyya gotdairyya commented Feb 10, 2022

Does this PR close any open issues?

No.

Give a longer description of what this PR addresses and why it's needed

This is incorporating the functionality of MultiDynamic into MultiMatrix. It will be more generalized so that it can also account for categorical edge types.

Provide pictures/videos of the behavior before and after these changes (optional)

Edge slicing lets you pick numerical and date-formated edge variables and create slices.
image

Once the slices are created, you can navigate the network along the slice
image

Are there any additional TODOs before this PR is ready to go?

TODOs:

  • Check why variables don't load for networks that need subsetting
  • Add metadata to EdgeSlices.vue (toopltip + visualization)
  • Fix type issues
  • Clear timeline view for the hop query

@netlify
Copy link

netlify bot commented Feb 10, 2022

✔️ Deploy Preview for multimatrix ready!

🔨 Explore the source changes: 63f104e

🔍 Inspect the deploy log: https://app.netlify.com/sites/multimatrix/deploys/6229007b9bf10b00083fce43

😎 Browse the preview: https://deploy-preview-372--multimatrix.netlify.app/

@gotdairyya
Copy link
Contributor Author

@JackWilb can you take a look at the to-do I listed? I think the reason it doesn't work is because of when the edge variable list is created. It might need to be generated onMounted()

src/store/index.ts Outdated Show resolved Hide resolved
JackWilb
JackWilb previously approved these changes Feb 10, 2022
Copy link
Member

@JackWilb JackWilb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far, the UI needs some work, as you said. I think it's good to go, but maybe we should hold off until you have a PR for the UI changes.

Also, is there anything different in the edge slicing, and edge slices component that I haven't review in the multidyno?

return cleanedVariables;
}

const cleanedEdgeVariables = computed(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these be moved to the store, we have similar logic for the node variable lists there. It would make sense to put similar code together, and maybe we can even reduce some of the logic needed

@JackWilb
Copy link
Member

@JackWilb can you take a look at the to-do I listed? I think the reason it doesn't work is because of when the edge variable list is created. It might need to be generated onMounted()

It seems that the list generation relies on networkOnLoad, which wouldn't exist if the network doesn't get fetched because it's too big. You might need a refactor of that code if you want to see the list before you have a network downloaded. Also, it would then have to fetch the network split by time slices

@gotdairyya
Copy link
Contributor Author

Looks good so far, the UI needs some work, as you said. I think it's good to go, but maybe we should hold off until you have a PR for the UI changes.

Also, is there anything different in the edge slicing, and edge slices component that I haven't review in the multidyno?

nope! I just refactored some of the code so that it works with the MultiMatrix setup, but nothing new yet

@gotdairyya
Copy link
Contributor Author

gotdairyya commented Feb 14, 2022

Made some bigger changes:

  • slices show the number of edges within each section
  • now slices can be made along categorical variables
  • the input form for category v. number v. date input is now different
  • cleaned up the UI stuff that was bothering me
  • slices are cleared when a connectivity query is made

Left to do: I need some help with the type errors (sorry, I just can't figure out what's going on this time around)

@gotdairyya gotdairyya requested a review from JackWilb February 14, 2022 16:20
Copy link
Member

@JackWilb JackWilb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm planning to give you a couple rounds of review. The first here will be higher level issues, and then I'll comment on specific code that might be updated in the next round.

Here are a few other things I noticed:

  • I can't see a tooltip
  • It was unintuitive to me that some of the slices were orange and some were not when I first made a network. The tooltip will help with this, but is there some other way we can show what the orange represents?
  • There isn't enough padding on the "Edge Slices" at the top of the vis
  • It looks like the SVG you added could be smaller from some playing around. I think 30px high would make it fit in a bit more. Unless I missed something that goes below each of the bars.
  • I found it unintuitive that there were separate variables for start and end. Looking at your screenshot, it seems a bit more clear, but why would we want it across 2 variables? Is that something we could hide unless the user asks for it, knowing that end variable is a separate column in their data?
  • There should be a button somewhere that will clean all the edge slicing away. It seems that the best way to do that currently is to remove the variables from the panel and re-run the slicing, but that's too much work for a user. If it's one button to clear, that will be much nicer.
  • We should open an issue to make sure that the sorting we implement is able to take information from slices instead of the whole network
  • Is there a nice way we can show what ranges of values fall into each time slice?

@@ -228,6 +228,8 @@ export default defineComponent({
store.dispatch.updateNetwork({ network: newNetwork });
loading.value = false;
store.commit.setDirectionalEdges(true);
// remove sliced network
store.commit.setSlicedNetwork([]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should just be a part of updateNetwork? It seems that every time it updates, we'd want to unset this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea!

@gotdairyya gotdairyya requested a review from JackWilb February 17, 2022 22:13
@gotdairyya
Copy link
Contributor Author

Date + Time View:
image

Numeric + Time View:
image

Numeric View:
image

Categorical View:
image

Copy link
Member

@JackWilb JackWilb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far! I have a smaller round of changes here that will just help with some papercuts

src/components/EdgeSlicing.vue Show resolved Hide resolved
src/components/FilterOverlay.vue Outdated Show resolved Hide resolved
src/components/EdgeSlices.vue Outdated Show resolved Hide resolved
src/components/EdgeSlices.vue Show resolved Hide resolved
src/components/EdgeSlices.vue Show resolved Hide resolved
src/components/EdgeSlices.vue Outdated Show resolved Hide resolved
src/components/EdgeSlices.vue Outdated Show resolved Hide resolved
}
});

function sliceNetwork() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails silently if the range specified by user is outside of the values of the data. For example, I have data from 0 to 31 and if I specify -100 to 31, it fails without alerting the user. We could have some simple validation and show errors to the user when it happens

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved for both number inputs and date inputs

const selectedArray: ComputedRef<boolean[]> = computed(() => Array.from(Array(timeRangesLength.value), (_, x: number) => (x === 0)));
function isSelected(key: number) {
selectedArray.value.fill(false);
selectedArray.value[key] = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing a value on a computed ref like this is dangerous. You should change the computedref to a ref and a watcher on timeRangesLength just to reset it when it changes, and then you can modify the array without it magically getting updated by the computed component

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW (might not apply here) you can use a "computed setter" (V2: https://v2.vuejs.org/v2/guide/computed.html#Computed-Setter) or a "writable computed" (V3: https://vuejs.org/guide/essentials/computed.html#writable-computed) to give semantics to "changing a value on a computed ref".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this has also been fixed!

@gotdairyya
Copy link
Contributor Author

As an overview, here is the expected views by data type.

CATEGORICAL
image

TIME BUT NOT DATE
image

TIME AND DATE
image

@gotdairyya gotdairyya requested a review from JackWilb March 9, 2022 00:23
JackWilb
JackWilb previously approved these changes Mar 9, 2022
Copy link
Member

@JackWilb JackWilb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a couple of small things, but in general, it's looking good to go!

@@ -490,7 +491,7 @@ export default defineComponent({
color="primary"
block
depressed
:disabled="!isValidRange && !isDate"
:disabled="!isValidRange && !isDate && isNumeric"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? Shouldn't it be just !isValidRange? Why would we disable it if it's numeric?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so that the isValidRange only does the check for isNumeric selections. Otherwise, you can't slice along categories

src/components/EdgeSlicing.vue Outdated Show resolved Hide resolved
@gotdairyya gotdairyya merged commit 16cd064 into main Mar 9, 2022
@gotdairyya gotdairyya deleted the edge-slicing branch March 9, 2022 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants