@Throws(Exception::class) fun test_sssp_linkType_constraint() { val p: SmallWeightedGraphProblem = setupSmallWeightedGraphProblem() val gasEngine: IGASEngine = getGraphFixture().newGASEngine(1) try { val graphAccessor: IGraphAccessor = getGraphFixture().newGraphAccessor(null) val gasContext: IGASContext<SSSP.VS, SSSP.ES, Int> = gasEngine.newGASContext(graphAccessor, SSSP()) gasContext.setLinkType(p.getFoafKnows() as URI) val gasState: IGASState<SSSP.VS, SSSP.ES, Int> = gasContext.getGASState() gasState.setFrontier(gasContext, p.getV1()) gasContext.call() assertEquals(0.0, gasState.getState(p.getV1()).dist()) assertEquals(1.0, gasState.getState(p.getV2()).dist()) assertEquals(1.0, gasState.getState(p.getV3()).dist()) assertEquals(2.0, gasState.getState(p.getV4()).dist()) assertEquals(2.0, gasState.getState(p.getV5()).dist()) } finally { gasEngine.shutdownNow() } }
A unit test based on graph with link weights - in this version of the test we constrain the link type but do not specify the link attribute type . Hence it ignores the link weights . This provides a test of the optimized access path when just the link type constraint is specified .