From 482a8014415a53ef694b321ca8e920cd70884311 Mon Sep 17 00:00:00 2001 From: derya Date: Sat, 23 Jul 2022 17:48:16 -0600 Subject: [PATCH 1/7] Naive filter on large query --- src/components/ConnectivityQuery.vue | 4 ++++ src/components/ControlPanel.vue | 7 ++++--- src/store/index.ts | 5 +++++ src/types.ts | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/ConnectivityQuery.vue b/src/components/ConnectivityQuery.vue index 90fe3c3a..39bfb3bc 100644 --- a/src/components/ConnectivityQuery.vue +++ b/src/components/ConnectivityQuery.vue @@ -569,6 +569,10 @@ export default defineComponent({ store.commit.setDirectionalEdges(true); store.commit.setQueriedNetworkState(true); store.commit.setDegreeEntries(setNodeDegreeDict(store.state.networkPreFilter, store.state.networkOnLoad, store.state.queriedNetwork, store.state.directionalEdges)); + if (promise.length >= 100) { + store.commit.setMinDegree(5); + store.commit.setDegreeNetwork([5, store.state.maxDegree]); + } } else { // Update state with empty network store.dispatch.aggregateNetwork(undefined); diff --git a/src/components/ControlPanel.vue b/src/components/ControlPanel.vue index ed684190..31ed43fb 100644 --- a/src/components/ControlPanel.vue +++ b/src/components/ControlPanel.vue @@ -88,10 +88,11 @@ export default defineComponent({ }); const maxConnections = computed(() => store.state.maxConnections); const maxDegree = computed(() => store.state.maxDegree); - const degreeRange = ref([0, maxDegree.value]); + const minDegree = computed(() => store.state.minDegree); + const degreeRange = ref([minDegree.value, maxDegree.value]); - watch([maxDegree], () => { - degreeRange.value = [0, maxDegree.value]; + watch([maxDegree, minDegree], () => { + degreeRange.value = [minDegree.value, maxDegree.value]; }); // Intermediate node table template objects diff --git a/src/store/index.ts b/src/store/index.ts index a0ea9902..fb7f25c8 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -78,6 +78,7 @@ const { selectedHops: 1, nodeDegreeDict: {}, maxDegree: 0, + minDegree: 0, networkPreFilter: null, queriedNetwork: false, filteredNetwork: false, @@ -389,6 +390,10 @@ const { state.nodeDegreeDict = degreeObject.nodeDegreeDict; }, + setMinDegree(state, minDegree: number) { + state.minDegree = minDegree; + }, + setDegreeNetwork(state, degreeRange: number[]) { // Determine correct network to use let baseNetwork: Network = { nodes: [], edges: [] }; diff --git a/src/types.ts b/src/types.ts index 2d1a6bcb..b62f9bdd 100644 --- a/src/types.ts +++ b/src/types.ts @@ -129,6 +129,7 @@ export interface State { selectedHops: number; nodeDegreeDict: { [key: string]: number }; maxDegree: number; + minDegree: number; networkPreFilter: Network | null; queriedNetwork: boolean; filteredNetwork: boolean; From cae19b5072619f5be5a3d2b884f32e70f4f9bd7c Mon Sep 17 00:00:00 2001 From: derya Date: Sat, 23 Jul 2022 17:57:10 -0600 Subject: [PATCH 2/7] Add children count to hover --- src/components/MultiMatrix.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/MultiMatrix.vue b/src/components/MultiMatrix.vue index 8b077a4d..c335b440 100644 --- a/src/components/MultiMatrix.vue +++ b/src/components/MultiMatrix.vue @@ -163,7 +163,11 @@ export default defineComponent({ // Loop through other props to add to tooltip Object.keys(networkElement).forEach((key) => { if (!['_key', '_rev', 'id', 'neighbors'].includes(key)) { - message += `
${capitalizeFirstLetter(key)}: ${networkElement[key]}`; + if (key === 'children') { + message += `
${capitalizeFirstLetter(key)}: ${networkElement[key].length}`; + } else { + message += `
${capitalizeFirstLetter(key)}: ${networkElement[key]}`; + } } }); } From a090a5f6802f737255a0aeca449ce0149b66a606 Mon Sep 17 00:00:00 2001 From: derya Date: Mon, 25 Jul 2022 14:59:33 -0600 Subject: [PATCH 3/7] Generate meaningful min degree --- src/components/ConnectivityQuery.vue | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/ConnectivityQuery.vue b/src/components/ConnectivityQuery.vue index 39bfb3bc..342a1f06 100644 --- a/src/components/ConnectivityQuery.vue +++ b/src/components/ConnectivityQuery.vue @@ -570,8 +570,24 @@ export default defineComponent({ store.commit.setQueriedNetworkState(true); store.commit.setDegreeEntries(setNodeDegreeDict(store.state.networkPreFilter, store.state.networkOnLoad, store.state.queriedNetwork, store.state.directionalEdges)); if (promise.length >= 100) { - store.commit.setMinDegree(5); - store.commit.setDegreeNetwork([5, store.state.maxDegree]); + console.log(store.state.nodeDegreeDict); + // Create dictionary of degree occurences + const orderedList = Object.values(store.state.nodeDegreeDict).sort((a, b) => a - b); + const degreeCount: {[key:number]:number} = {}; + // eslint-disable-next-line no-plusplus + for (let i = 0; i < orderedList.length; i++) { + degreeCount[orderedList[i]] = (degreeCount[orderedList[i]] || 0) + 1; + } + console.log(degreeCount); + // Set min value if the node degree occurence < 100 + Object.entries(degreeCount).every(([degree, occurence]) => { + if (occurence < 100) { + console.log(occurence, degree, 'hello!'); + store.commit.setMinDegree(Number(degree)); + store.commit.setDegreeNetwork([Number(degree), store.state.maxDegree]); + return false; + } return true; + }); } } else { // Update state with empty network From 468387f9bee62d8d264cf17c9dbfe47d8a2274f6 Mon Sep 17 00:00:00 2001 From: derya Date: Mon, 25 Jul 2022 15:00:11 -0600 Subject: [PATCH 4/7] Remove console logs --- src/components/ConnectivityQuery.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/ConnectivityQuery.vue b/src/components/ConnectivityQuery.vue index 342a1f06..3c7c26af 100644 --- a/src/components/ConnectivityQuery.vue +++ b/src/components/ConnectivityQuery.vue @@ -570,7 +570,6 @@ export default defineComponent({ store.commit.setQueriedNetworkState(true); store.commit.setDegreeEntries(setNodeDegreeDict(store.state.networkPreFilter, store.state.networkOnLoad, store.state.queriedNetwork, store.state.directionalEdges)); if (promise.length >= 100) { - console.log(store.state.nodeDegreeDict); // Create dictionary of degree occurences const orderedList = Object.values(store.state.nodeDegreeDict).sort((a, b) => a - b); const degreeCount: {[key:number]:number} = {}; @@ -578,11 +577,10 @@ export default defineComponent({ for (let i = 0; i < orderedList.length; i++) { degreeCount[orderedList[i]] = (degreeCount[orderedList[i]] || 0) + 1; } - console.log(degreeCount); + // Set min value if the node degree occurence < 100 Object.entries(degreeCount).every(([degree, occurence]) => { if (occurence < 100) { - console.log(occurence, degree, 'hello!'); store.commit.setMinDegree(Number(degree)); store.commit.setDegreeNetwork([Number(degree), store.state.maxDegree]); return false; From b53bacdc42602e25d74ca06cb76352fc9db99883 Mon Sep 17 00:00:00 2001 From: JackWilb Date: Tue, 26 Jul 2022 09:38:57 -0600 Subject: [PATCH 5/7] Fix type issue with node.children --- src/components/MultiMatrix.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/MultiMatrix.vue b/src/components/MultiMatrix.vue index c335b440..d3fa9fc0 100644 --- a/src/components/MultiMatrix.vue +++ b/src/components/MultiMatrix.vue @@ -163,8 +163,8 @@ export default defineComponent({ // Loop through other props to add to tooltip Object.keys(networkElement).forEach((key) => { if (!['_key', '_rev', 'id', 'neighbors'].includes(key)) { - if (key === 'children') { - message += `
${capitalizeFirstLetter(key)}: ${networkElement[key].length}`; + if (key === 'children' && networkElement.children !== undefined) { + message += `
${capitalizeFirstLetter(key)}: ${networkElement.children.length}`; } else { message += `
${capitalizeFirstLetter(key)}: ${networkElement[key]}`; } From d10dbc35cac40c7f14561755acb555ed02201983 Mon Sep 17 00:00:00 2001 From: derya Date: Wed, 27 Jul 2022 10:56:09 -0600 Subject: [PATCH 6/7] Remove double network render --- src/components/ConnectivityQuery.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/ConnectivityQuery.vue b/src/components/ConnectivityQuery.vue index 3c7c26af..0d8b90dc 100644 --- a/src/components/ConnectivityQuery.vue +++ b/src/components/ConnectivityQuery.vue @@ -563,7 +563,6 @@ export default defineComponent({ // Update state with new network store.dispatch.aggregateNetwork(undefined); - store.dispatch.updateNetwork({ network: newNetwork }); store.commit.setNetworkPreFilter(newNetwork); loading.value = false; store.commit.setDirectionalEdges(true); @@ -579,6 +578,7 @@ export default defineComponent({ } // Set min value if the node degree occurence < 100 + // Using every to stop for loop once the conditional is met Object.entries(degreeCount).every(([degree, occurence]) => { if (occurence < 100) { store.commit.setMinDegree(Number(degree)); @@ -586,6 +586,9 @@ export default defineComponent({ return false; } return true; }); + } else { + // Update state with new network + store.dispatch.updateNetwork({ network: newNetwork }); } } else { // Update state with empty network From ba9a9591be85261d4871100302eac67c860fa6f8 Mon Sep 17 00:00:00 2001 From: JackWilb Date: Fri, 29 Jul 2022 12:15:52 -0600 Subject: [PATCH 7/7] Fix comments, all paths through if statement to update network --- src/components/ConnectivityQuery.vue | 29 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/components/ConnectivityQuery.vue b/src/components/ConnectivityQuery.vue index 0d8b90dc..4aac396b 100644 --- a/src/components/ConnectivityQuery.vue +++ b/src/components/ConnectivityQuery.vue @@ -572,20 +572,25 @@ export default defineComponent({ // Create dictionary of degree occurences const orderedList = Object.values(store.state.nodeDegreeDict).sort((a, b) => a - b); const degreeCount: {[key:number]:number} = {}; - // eslint-disable-next-line no-plusplus - for (let i = 0; i < orderedList.length; i++) { - degreeCount[orderedList[i]] = (degreeCount[orderedList[i]] || 0) + 1; - } + orderedList.forEach((olItem) => { + degreeCount[olItem] = (degreeCount[olItem] || 0) + 1; + }); - // Set min value if the node degree occurence < 100 + // Set min value if the node degree occurrence < 100 // Using every to stop for loop once the conditional is met - Object.entries(degreeCount).every(([degree, occurence]) => { - if (occurence < 100) { - store.commit.setMinDegree(Number(degree)); - store.commit.setDegreeNetwork([Number(degree), store.state.maxDegree]); - return false; - } return true; - }); + if ( + // If all degrees have 100 connections of more + Object.entries(degreeCount).every(([degree, occurrence]) => { + if (occurrence < 100) { + store.commit.setMinDegree(Number(degree)); + // This calls updateNetwork + store.commit.setDegreeNetwork([Number(degree), store.state.maxDegree]); + return false; + } return true; + }) + ) { + store.dispatch.updateNetwork({ network: newNetwork }); + } } else { // Update state with new network store.dispatch.updateNetwork({ network: newNetwork });