Skip to content

Commit 39da1f4

Browse files
committed
feat: move main implementation of getGraph() on StateGraph
work on #24
1 parent 9c1b39b commit 39da1f4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

core-jdk8/src/main/java/org/bsc/langgraph4j/StateGraph.java

+30
Original file line numberDiff line numberDiff line change
@@ -308,4 +308,34 @@ public CompiledGraph<State> compile() throws GraphStateException {
308308
return compile(CompileConfig.builder().build());
309309
}
310310

311+
/**
312+
* Generates a drawable graph representation of the state graph.
313+
*
314+
* @param type the type of graph representation to generate
315+
* @param title the title of the graph
316+
* @param printConditionalEdges whether to print conditional edges
317+
* @return a diagram code of the state graph
318+
*/
319+
public GraphRepresentation getGraph( GraphRepresentation.Type type, String title, boolean printConditionalEdges ) {
320+
321+
String content = type.generator.generate( this, title, printConditionalEdges);
322+
323+
return new GraphRepresentation( type, content );
324+
}
325+
326+
/**
327+
* Generates a drawable graph representation of the state graph.
328+
*
329+
* @param type the type of graph representation to generate
330+
* @param title the title of the graph
331+
* @return a diagram code of the state graph
332+
*/
333+
public GraphRepresentation getGraph( GraphRepresentation.Type type, String title ) {
334+
335+
String content = type.generator.generate( this, title, true);
336+
337+
return new GraphRepresentation( type, content );
338+
}
339+
340+
311341
}

0 commit comments

Comments
 (0)