File tree Expand file tree Collapse file tree
core-api/src/main/java/org/neo4j/gds/api
core/src/main/java/org/neo4j/gds Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) "Neo4j"
3+ * Neo4j Sweden AB [http://neo4j.com]
4+ *
5+ * This file is part of Neo4j.
6+ *
7+ * Neo4j is free software: you can redistribute it and/or modify
8+ * it under the terms of the GNU General Public License as published by
9+ * the Free Software Foundation, either version 3 of the License, or
10+ * (at your option) any later version.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+ package org .neo4j .gds .api ;
21+
22+ import org .neo4j .gds .RelationshipType ;
23+
24+ public interface GraphStoreWithTopology extends GraphStore {
25+ Topology getTopology (RelationshipType relationshipType );
26+ }
Original file line number Diff line number Diff line change 3838import java .util .Optional ;
3939import java .util .Set ;
4040
41- public abstract class GraphStoreAdapter implements GraphStore {
41+ public abstract class GraphStoreAdapter implements GraphStoreWithTopology {
4242
4343 private final GraphStore graphStore ;
4444
@@ -318,4 +318,14 @@ public CompositeRelationshipIterator getCompositeRelationshipIterator(
318318 ) {
319319 return graphStore .getCompositeRelationshipIterator (relationshipType , propertyKeys );
320320 }
321+
322+ @ Override
323+ public Topology getTopology (RelationshipType relationshipType ) {
324+ if (graphStore instanceof GraphStoreWithTopology gWT ) {
325+ return gWT .getTopology (relationshipType );
326+ }
327+ throw new UnsupportedOperationException (
328+ "GraphStore does not support getting topology for relationship type: " + relationshipType
329+ );
330+ }
321331}
Original file line number Diff line number Diff line change 3030import org .neo4j .gds .api .DatabaseInfo ;
3131import org .neo4j .gds .api .FilteredIdMap ;
3232import org .neo4j .gds .api .GraphCharacteristics ;
33- import org .neo4j .gds .api .GraphStore ;
33+ import org .neo4j .gds .api .GraphStoreWithTopology ;
3434import org .neo4j .gds .api .IdMap ;
3535import org .neo4j .gds .api .PropertyState ;
3636import org .neo4j .gds .api .Topology ;
7777import static org .neo4j .gds .utils .StringFormatting .formatWithLocale ;
7878
7979@ Value .Style (typeBuilder = "GraphStoreBuilder" )
80- public final class CSRGraphStore implements GraphStore {
80+ public final class CSRGraphStore implements GraphStoreWithTopology {
8181
8282 private final Concurrency concurrency ;
8383
@@ -474,6 +474,7 @@ public DeletionResult deleteRelationships(RelationshipType relationshipType) {
474474 }));
475475 }
476476
477+ @ Override
477478 public Topology getTopology (RelationshipType relationshipType ) {
478479 return relationships .get (relationshipType ).topology ();
479480 }
You can’t perform that action at this time.
0 commit comments