-
Notifications
You must be signed in to change notification settings - Fork 0
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
Unstable neo4j update #388
Conversation
… to 4500 also fix database port
… to 4500 also fix database port
You mean it is not a valid cytoscape.js selector. Right? If so where does these selectors are used? As far as I remember, they are only used in highlighting elements on hover. If it's the case, why don't we select them with selectors like Always replacing elementIds seems high maintenance to me. Also I see that elementId is just a string and it can be a cytoscape.js element id. |
Yes, you are right. I changed the selectors as you suggested. Now all elementIds are in the same format without any replacements used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1-) In some places, there might be some performance regression. O(n) is replaced with O(n^2). I think those can be done in O(n)
2-) I don't have access to deployed visual env. Please test there
3-) some time ago, there were Cypress e2e tests. Do they still run? If so, can you run them
4-) As an improvement those Cypress test could be run as a new step of the current Github Action
If you do points 1 & 2 I think it's good to merge. 3 & 4 could be future improvements. But if you could do point 3, it would be great to see this big change doesn't cause any bugs.
src/app/visuall/cytoscape.service.ts
Outdated
@@ -202,8 +201,7 @@ export class CytoscapeService { | |||
let compoundEdgeIds2 = this._g.cy.edges('.' + C.COLLAPSED_EDGE_CLASS).map(x => x.id()); | |||
elemIds.push(...C.arrayDiff(compoundEdgeIds, compoundEdgeIds2)); | |||
// elements might already exist but hidden, so show them | |||
this._g.viewUtils.show(this._g.cy.$(elemIds.map(x => '#' + x).join(','))); | |||
|
|||
this._g.viewUtils.show(this._g.cy.nodes().filter(node => elemIds.includes(node.id()))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: includes
inside .filter()
function might be O(n^2). The previous implementation might be faster. Please check this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is no longer possible to use the previous implementation as the ID cannot be utilized as a CSS selector anymore. Your observation about the runtime being O(n^2) was correct, and this is not an optimal practice. To enhance runtime to O(n), we can use a set to gather element IDs. In a set, the 'has' operation requires constant time due to the hash table implementation, but it also results in unnecessary memory consumption.
const elemIdSet = new Set(elemIds);
this._g.viewUtils.show(this._g.cy.nodes().filter(node => elemIdSet.has(node.id())));
if (!isTimeboxed) { | ||
q = query; | ||
} | ||
let q = isTimeboxed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: good that if removed. q
might be a const
@@ -296,7 +296,7 @@ export class AdvancedQueriesComponent implements OnInit, OnDestroy { | |||
|
|||
private highlightSeedNodes() { | |||
const dbIds = this.selectedNodes.map(x => x.dbId); | |||
const seedNodes = this._g.cy.nodes(dbIds.map(x => '#n' + x).join()); | |||
const seedNodes = this._g.cy.nodes().filter(node => dbIds.includes(node.id().substring(1))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: .includes
inside .filter
might be O(n^2). This is a performance regression. Can we do it in linear time?
@@ -316,7 +316,7 @@ export class AdvancedQueriesComponent implements OnInit, OnDestroy { | |||
if (!dbIds || dbIds.length < 1) { | |||
return; | |||
} | |||
const cyNodes = this._g.cy.nodes(dbIds.map(x => '#n' + x).join()); | |||
const cyNodes = this._g.cy.nodes().filter(node => dbIds.includes(node.id().substring(1))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: .includes
inside .filter
might be O(n^2). This is a performance regression. Can we do it in linear time?
src/app/visuall/operation-tabs/query-tab/advanced-queries/advanced-queries.component.ts
Show resolved
Hide resolved
I'd like to inform you of the following updates:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any other issue. I don't have access to Visuall env. So I cannot test it properly with the deployed environment. But it looks OK except for the issue I mentioned
src/app/visuall/cytoscape.service.ts
Outdated
this._g.viewUtils.show(this._g.cy.$(elemIds.map(x => '#' + x).join(','))); | ||
|
||
const elemIdSet = new Set(elemIds); | ||
this._g.viewUtils.show(this._g.cy.nodes().filter(node => elemIdSet.has(node.id()))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: elemId could be an edge. So don't use cy.nodes()
instead use cy.elements()
I have made changes to the visual application in response to the issues mentioned in #387. The modifications involve using Neo4j version 5.10. Here are the details of the changes made:
For testing on your local environment, you can use the new Neo4j 5.10 database working on the ivis server port:3001. The credentials are username: neo4j and password: 12345678. You should change the environment.ts accordingly.