Langgraph Compare Package
langgraph_compare.analyze
- langgraph_compare.analyze.get_act_counts(event_log: DataFrame) dict[str, int] [source]
Get the counts of every activity in the event log.
- Parameters:
event_log (pd.DataFrame) – Event log data.
- Returns:
Activity counts.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_act_counts(event_log)) Event log loaded and formated from file: files/examples.csv {'__start__': 27, 'ag_supervisor': 27, 'test_supervisor': 27, 'rg_supervisor': 22, 'DocWriter': 8, 'Search': 5, 'WebScraper': 5, 'ChartGenerator': 3, 'NoteTaker': 3}
- langgraph_compare.analyze.get_act_reworks(event_log: DataFrame) dict[int, dict[str, int]] [source]
Return the rework counts for each activity in each case.
- Parameters:
event_log (pd.DataFrame) – Event log data.
- Returns:
Rework counts for each case ID.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_global_act_reworks(event_log)) Event log loaded and formated from file: files/examples.csv {18: {}, 19: {'__start__': 18, 'test_supervisor': 18, 'rg_supervisor': 15, 'Search': 3, 'WebScraper': 4, 'ag_supervisor': 14, 'DocWriter': 4}, 20: {'__start__': 8, 'test_supervisor': 8, 'rg_supervisor': 7, 'Search': 2, 'ag_supervisor': 12, 'ChartGenerator': 2, 'DocWriter': 4, 'NoteTaker': 3}}
- langgraph_compare.analyze.get_avg_duration(event_log: DataFrame) float [source]
Calculate average duration of the case in seconds.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_avg_duration(event_log)) Event log loaded and formated from file: files/examples.csv 91.56
- langgraph_compare.analyze.get_durations(event_log: DataFrame) dict[str, float] [source]
Calculate the duration of each case in seconds.
- Parameters:
event_log (pd.DataFrame) – Event log data.
- Returns:
Case durations.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_durations(event_log)) Event log loaded and formated from file: files/examples.csv {'18': 4.580137, '19': 120.730501, '20': 74.653202}
- langgraph_compare.analyze.get_ends(event_log: DataFrame) dict[str, int] [source]
Get the end activities of the event log.
- Parameters:
event_log (pd.DataFrame) – Event log data.
- Returns:
End activities and their counts.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_ends(event_log)) Event log loaded and formated from file: files/examples.csv {'test_supervisor': 3}
- langgraph_compare.analyze.get_global_act_reworks(event_log: DataFrame) dict[str, int] [source]
Return the global rework counts for each activity by summing reworks from each case. A rework is counted when an activity appears more than once within the same case.
- Parameters:
event_log (pd.DataFrame) – Event log data.
- Returns:
Global rework counts for each activity.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_global_act_reworks(event_log)) Event log loaded and formated from file: files/examples.csv {'__start__': 24, 'test_supervisor': 24, 'rg_supervisor': 20, 'Search': 3, 'WebScraper': 2, 'ag_supervisor': 24, 'DocWriter': 6, 'ChartGenerator': 1, 'NoteTaker': 2}
- langgraph_compare.analyze.get_mean_act_times(event_log: DataFrame) dict[str, float] [source]
Calculate the mean service time for each activity.
- Parameters:
event_log (pd.DataFrame) – Event log data.
- Returns:
Mean service times for each activity.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_mean_act_times(event_log)) Event log loaded and formated from file: files/examples.csv {'ChartGenerator': 0.587241, 'DocWriter': 1.0209089999999998, 'NoteTaker': 0.5753873333333334, 'Search': 0.580575, 'WebScraper': 0.6020846, '__start__': 0.0411957037037037, 'ag_supervisor': 0.007210296296296296, 'rg_supervisor': 1.8212668636363636, 'test_supervisor': 0.04827048148148148}
- langgraph_compare.analyze.get_min_self_dists(event_log: DataFrame) dict[int, dict[str, int]] [source]
Calculate the minimum self-distances for each activity in each case.
- Parameters:
event_log (pd.DataFrame) – Event log data.
- Returns:
Dictionary where keys are case IDs and values are dictionaries of activities with their minimum self-distances.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_min_self_dists(event_log)) Event log loaded and formated from file: files/examples.csv {18: {}, 19: {'DocWriter': 1, 'Search': 6, 'WebScraper': 4, '__start__': 1, 'ag_supervisor': 1, 'rg_supervisor': 1, 'test_supervisor': 2}, 20: {'ChartGenerator': 1, 'DocWriter': 3, 'NoteTaker': 3, 'Search': 36, '__start__': 1, 'ag_supervisor': 1, 'rg_supervisor': 1, 'test_supervisor': 2}}
- langgraph_compare.analyze.get_self_dist_witnesses(event_log: DataFrame) dict[int, dict[str, list[list[str]]]] [source]
Compute the minimum self-distance witnesses for each activity in each case of the event log, considering both activity name and resource.
- Parameters:
event_log (pd.DataFrame) – Event log data containing events with case IDs, activity names, and resources
- Returns:
A dictionary where each key is a case ID, and each value is another dictionary mapping activities to lists of witness sequences.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_all_self_distance_witnesses(event_log)) Event log loaded and formated from file: files/examples.csv {18: {}, 19: {'__start__': [['test_supervisor']], 'test_supervisor': [['__start__', 'rg_supervisor'], ['__start__', 'ag_supervisor']], 'rg_supervisor': [['Search'], ['WebScraper']], 'Search': [['rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor']], 'WebScraper': [['rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor']], 'ag_supervisor': [['DocWriter'], ['ChartGenerator']], 'DocWriter': [['ag_supervisor']]}, 20: {'__start__': [['test_supervisor']], 'test_supervisor': [['__start__', 'rg_supervisor']], 'rg_supervisor': [['Search'], ['WebScraper']], 'Search': [['rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor']], 'ag_supervisor': [['DocWriter'], ['ChartGenerator'], ['NoteTaker']], 'ChartGenerator': [['ag_supervisor']], 'DocWriter': [['ag_supervisor', 'NoteTaker', 'ag_supervisor']], 'NoteTaker': [['ag_supervisor', 'DocWriter', 'ag_supervisor']]}}
- langgraph_compare.analyze.get_sequence_probs(event_log: DataFrame) list[tuple[int, tuple[str, ...], float]] [source]
Return sequences with probabilities for each case ID. If sequence already occurred it only lists the ID of the latest occurrence.
- Parameters:
event_log (pd.DataFrame) – Event log data.
- Returns:
List of tuples containing (case ID, sequence, probability).
- Return type:
list
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_sequence_probs(event_log)) Event log loaded and formated from file: files/examples.csv [(18, ('__start__', 'ag_supervisor', 'test_supervisor'), 0.3333333333333333), (19, ('__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor'), 0.3333333333333333), (20, ('__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor'), 0.3333333333333333)]
- langgraph_compare.analyze.get_sequences(event_log: DataFrame) dict[int, list[str]] [source]
Return activity sequences for every case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
- Returns:
Mapping of case IDs to their activity sequences.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_sequences(event_log)) Event log loaded and formated from file: files/examples.csv {18: ['__start__', 'ag_supervisor', 'test_supervisor'], 19: ['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor'], 20: ['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor']}
- langgraph_compare.analyze.get_starts(event_log: DataFrame) dict[str, int] [source]
Get the start activities of the event log.
- Parameters:
event_log (pd.DataFrame) – Event log data.
- Returns:
Start activities and their counts.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_starts(event_log)) Event log loaded and formated from file: files/examples.csv {'__start__': 3}
- langgraph_compare.analyze.print_act_counts(event_log: DataFrame) None [source]
Print the counts of every activity in the event log.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_act_counts(event_log) Event log loaded and formated from file: files/examples.csv Count of each activity: {'__start__': 27, 'ag_supervisor': 27, 'test_supervisor': 27, 'rg_supervisor': 22, 'DocWriter': 8, 'Search': 5, 'WebScraper': 5, 'ChartGenerator': 3, 'NoteTaker': 3}
- langgraph_compare.analyze.print_act_reworks(event_log: DataFrame) None [source]
Print the rework counts for each activity in each case.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_act_reworks(event_log) Event log loaded and formated from file: files/examples.csv Count of activity rework: Case ID 18: {} Case ID 19: {'__start__': 18, 'test_supervisor': 18, 'rg_supervisor': 15, 'Search': 3, 'WebScraper': 4, 'ag_supervisor': 14, 'DocWriter': 4} Case ID 20: {'__start__': 8, 'test_supervisor': 8, 'rg_supervisor': 7, 'Search': 2, 'ag_supervisor': 12, 'ChartGenerator': 2, 'DocWriter': 4, 'NoteTaker': 3}
- langgraph_compare.analyze.print_analysis(event_log: DataFrame) None [source]
Run multiple analyses on the event log and print the results.
- Parameters:
event_log (pd.DataFrame) – The event log data to analyze.
Example:
csv_output = "files/examples.csv" event_log = load_event_log(csv_output) print_all_self_distance_witnesses(event_log) # Event log loaded and formated from file: files/examples.csv # # #########################START######################### # # Start activities: {'__start__': 3} # # End activities: {'test_supervisor': 3} # # Count of each activity: {'ag_supervisor': 24, '__start__': 14, 'test_supervisor': 14, 'rg_supervisor': 12, 'DocWriter': 7, 'NoteTaker': 6, 'ChartGenerator': 6, 'Search': 3, 'WebScraper': 3} # # All sequences: # Case ID 1: ['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor'] # Case ID 2: ['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor'] # Case ID 3: ['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor'] # # ID of last sequence occurrence with probability of occurrence: # Case ID 1: ('__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor') # Probability: 0.333 # # Case ID 2: ('__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor') # Probability: 0.333 # # Case ID 3: ('__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor') # Probability: 0.333 # # Minimal self-distances for every activity: # Case ID 1: {'__start__': 1, 'ag_supervisor': 1, 'rg_supervisor': 1, 'test_supervisor': 2} # Case ID 2: {'ChartGenerator': 5, 'DocWriter': 1, 'NoteTaker': 1, '__start__': 1, 'ag_supervisor': 1, 'rg_supervisor': 1, 'test_supervisor': 2} # Case ID 3: {'ChartGenerator': 1, '__start__': 1, 'ag_supervisor': 1, 'rg_supervisor': 1, 'test_supervisor': 2} # # Witnesses of minimum self-distances: # Case ID 1: {'__start__': [['test_supervisor']], 'test_supervisor': [['__start__', 'rg_supervisor']], 'rg_supervisor': [['WebScraper'], ['Search']], 'ag_supervisor': [['DocWriter'], ['NoteTaker'], ['ChartGenerator']]} # Case ID 2: {'__start__': [['test_supervisor']], 'test_supervisor': [['__start__', 'rg_supervisor'], ['__start__', 'ag_supervisor']], 'rg_supervisor': [['WebScraper'], ['Search']], 'ag_supervisor': [['DocWriter'], ['NoteTaker'], ['ChartGenerator']], 'NoteTaker': [['ag_supervisor']], 'ChartGenerator': [['ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor']], 'DocWriter': [['ag_supervisor']]} # Case ID 3: {'__start__': [['test_supervisor']], 'test_supervisor': [['__start__', 'rg_supervisor']], 'rg_supervisor': [['WebScraper'], ['Search']], 'ag_supervisor': [['DocWriter'], ['NoteTaker'], ['ChartGenerator']], 'ChartGenerator': [['ag_supervisor']]} # # Count of activity rework: # Case ID 1: {'__start__': 4, 'test_supervisor': 4, 'rg_supervisor': 4, 'ag_supervisor': 4} # Case ID 2: {'__start__': 6, 'test_supervisor': 6, 'rg_supervisor': 4, 'ag_supervisor': 15, 'NoteTaker': 4, 'ChartGenerator': 3, 'DocWriter': 5} # Case ID 3: {'__start__': 4, 'test_supervisor': 4, 'rg_supervisor': 4, 'ag_supervisor': 5, 'ChartGenerator': 2} # # Mean duration of every activity: # Activity 'ChartGenerator': 0.541 s # Activity 'DocWriter': 0.523 s # Activity 'NoteTaker': 0.606 s # Activity 'Search': 1.587 s # Activity 'WebScraper': 0.525 s # Activity '__start__': 0.288 s # Activity 'ag_supervisor': 0.005 s # Activity 'rg_supervisor': 0.759 s # Activity 'test_supervisor': 0.003 s # # Duration of the case: # Case ID 1: 43.88 s # Case ID 2: 62.252 s # Case ID 3: 29.688 s # # #########################END#########################
- langgraph_compare.analyze.print_avg_duration(event_log: DataFrame) None [source]
Print the average duration of the case in seconds.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_avg_duration(event_log) Event log loaded and formated from file: files/examples.csv Average case duration: 91.56 s
- langgraph_compare.analyze.print_durations(event_log: DataFrame) None [source]
Print the duration of each case in seconds.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_durations(event_log) Event log loaded and formated from file: files/examples.csv Duration of the case: Case ID 18: 4.580 s Case ID 19: 120.731 s Case ID 20: 74.653 s
- langgraph_compare.analyze.print_ends(event_log: DataFrame) None [source]
Print the end activities of the event log.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_ends(event_log) Event log loaded and formated from file: files/examples.csv End activities: {'test_supervisor': 3}
- langgraph_compare.analyze.print_global_act_reworks(event_log: DataFrame) None [source]
Return the global rework counts for each activity across all cases.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_global_act_reworks(event_log) Event log loaded and formated from file: files/examples.csv Global rework counts for each activity: Activity '__start__': 11 Activity 'test_supervisor': 11 Activity 'rg_supervisor': 9 Activity 'ag_supervisor': 21 Activity 'NoteTaker': 3 Activity 'ChartGenerator': 3 Activity 'DocWriter': 4
- langgraph_compare.analyze.print_mean_act_times(event_log: DataFrame) None [source]
Print the mean service time for each activity.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_mean_act_times(event_log) Event log loaded and formated from file: files/examples.csv Mean duration of every activity: Activity 'ChartGenerator': 0.587 s Activity 'DocWriter': 1.021 s Activity 'NoteTaker': 0.575 s Activity 'Search': 0.581 s Activity 'WebScraper': 0.602 s Activity '__start__': 0.0412 s Activity 'ag_supervisor': 0.007 s Activity 'rg_supervisor': 1.821 s Activity 'test_supervisor': 0.048 s
- langgraph_compare.analyze.print_min_self_dists(event_log: DataFrame) None [source]
Calculate and print the minimum self-distances for each activity in each case.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_min_self_dists(event_log) Event log loaded and formated from file: files/examples.csv Minimal self-distances for every activity: Case ID 18: {} Case ID 19: {'DocWriter': 1, 'Search': 6, 'WebScraper': 4, '__start__': 1, 'ag_supervisor': 1, 'rg_supervisor': 1, 'test_supervisor': 2} Case ID 20: {'ChartGenerator': 1, 'DocWriter': 3, 'NoteTaker': 3, 'Search': 36, '__start__': 1, 'ag_supervisor': 1, 'rg_supervisor': 1, 'test_supervisor': 2}
- langgraph_compare.analyze.print_self_dist_witnesses(event_log: DataFrame) None [source]
Print the minimum self-distance witnesses for each activity in each case.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_self_dist_witnesses(event_log) Event log loaded and formated from file: files/examples.csv Witnesses of minimum self-distances: Case ID 18: {} Case ID 19: {'__start__': [['test_supervisor']], 'test_supervisor': [['__start__', 'rg_supervisor'], ['__start__', 'ag_supervisor']], 'rg_supervisor': [['Search'], ['WebScraper']], 'Search': [['rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor']], 'WebScraper': [['rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor']], 'ag_supervisor': [['DocWriter'], ['ChartGenerator']], 'DocWriter': [['ag_supervisor']]} Case ID 20: {'__start__': [['test_supervisor']], 'test_supervisor': [['__start__', 'rg_supervisor']], 'rg_supervisor': [['Search'], ['WebScraper']], 'Search': [['rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor']], 'ag_supervisor': [['DocWriter'], ['ChartGenerator'], ['NoteTaker']], 'ChartGenerator': [['ag_supervisor']], 'DocWriter': [['ag_supervisor', 'NoteTaker', 'ag_supervisor']], 'NoteTaker': [['ag_supervisor', 'DocWriter', 'ag_supervisor']]}
- langgraph_compare.analyze.print_sequence_probs(event_log: DataFrame) None [source]
Print sequences with probabilities for each case ID. If sequence already occurred it only prints the ID of the latest occurrence.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_sequence_probs(event_log) Event log loaded and formated from file: files/examples.csv ID of last sequence occurrence with probability of occurrence: Case ID 18: ('__start__', 'ag_supervisor', 'test_supervisor') Probability: 0.333 Case ID 19: ('__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor') Probability: 0.333 Case ID 20: ('__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor') Probability: 0.333
- langgraph_compare.analyze.print_sequences(event_log: DataFrame) None [source]
Print sequences for every case ID in the event log, sorted numerically by case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_sequences(event_log) Event log loaded and formated from file: files/examples.csv All sequences: Case ID 18: ['__start__', 'ag_supervisor', 'test_supervisor'] Case ID 19: ['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor'] Case ID 20: ['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor']
- langgraph_compare.analyze.print_starts(event_log: DataFrame) None [source]
Print the start activities of the event log.
- Parameters:
event_log (pd.DataFrame) – Event log data.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_starts(event_log) Event log loaded and formated from file: files/examples.csv Start activities: {'__start__': 3}
langgraph_compare.analyze_case_id
- langgraph_compare.analyze_case_id.get_case_act_counts(event_log: DataFrame, case_id: int) dict[str, int] [source]
Count how many times each activity occurred for the specified case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to count activities for.
- Returns:
A dictionary with activities as keys and their counts as values.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_case_act_counts(event_log,19)) Event log loaded and formated from file: files/examples.csv {'__start__': 18, 'test_supervisor': 18, 'rg_supervisor': 15, 'Search': 3, 'WebScraper': 4, 'ag_supervisor': 14, 'ChartGenerator': 1, 'DocWriter': 4}
- langgraph_compare.analyze_case_id.get_case_act_reworks(event_log: DataFrame, case_id: int) dict[str, int] [source]
Return the rework counts for each activity for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve the rework counts for.
- Returns:
A dictionary of activities with their rework counts for the specified case ID.
- Return type:
dict
- Raises:
ValueError – If the case ID does not exist in the event log.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_case_act_reworks(event_log,19)) Event log loaded and formated from file: files/examples.csv {'__start__': 18, 'test_supervisor': 18, 'rg_supervisor': 15, 'Search': 3, 'WebScraper': 4, 'ag_supervisor': 14, 'DocWriter': 4}
- langgraph_compare.analyze_case_id.get_case_duration(event_log: DataFrame, case_id: int) float [source]
Calculate the duration time for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve the duration time for.
- Returns:
The duration time for the specified case ID.
- Return type:
float
- Raises:
ValueError – If the case ID does not exist in the event log.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_case_duration(event_log,19)) Event log loaded and formated from file: files/examples.csv 120.730501
- langgraph_compare.analyze_case_id.get_case_end(event_log: DataFrame, case_id: int) str [source]
Retrieve the last activity for the specified case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve the end activity for.
- Returns:
The last activity in the sequence.
- Return type:
str
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_case_end(event_log,19)) Event log loaded and formated from file: files/examples.csv test_supervisor
- langgraph_compare.analyze_case_id.get_case_min_self_dists(event_log: DataFrame, case_id: int) dict[str, int] [source]
Return the minimum self-distances for all activities for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve the minimum self-distances for.
- Returns:
A dictionary of activities with their minimum self-distances for the specified case ID.
- Return type:
dict
- Raises:
ValueError – If the case ID does not exist in the event log.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_case_min_self_dists(event_log,19)) Event log loaded and formated from file: files/examples.csv {'DocWriter': 1, 'Search': 6, 'WebScraper': 4, '__start__': 1, 'ag_supervisor': 1, 'rg_supervisor': 1, 'test_supervisor': 2}
- langgraph_compare.analyze_case_id.get_case_self_dist_witnesses(event_log: DataFrame, case_id: int) dict[str, list[list[str]]] [source]
Return the minimum self-distance witnesses for all activities for a specific case ID, considering both activity name and resource.
- Parameters:
event_log (pd.DataFrame) – Event log data containing events with case IDs, activity names, and resources.
case_id (int) – The case ID to retrieve the witnesses for.
- Returns:
A dictionary of activities with their witnesses for the specified case ID.
- Return type:
dict
- Raises:
ValueError – If the case ID does not exist in the event log.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_case_self_dist_witnesses(event_log,19)) Event log loaded and formated from file: files/examples.csv {'__start__': [['test_supervisor']], 'test_supervisor': [['__start__', 'ag_supervisor'], ['__start__', 'rg_supervisor']], 'rg_supervisor': [['Search'], ['WebScraper']], 'Search': [['rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor']], 'WebScraper': [['rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor']], 'ag_supervisor': [['DocWriter'], ['ChartGenerator']], 'DocWriter': [['ag_supervisor']]}
- langgraph_compare.analyze_case_id.get_case_sequence(event_log: DataFrame, case_id: int) list[str] [source]
Return the activity sequence for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve the sequence for.
- Returns:
The activity sequence for the specified case ID.
- Return type:
list
- Raises:
ValueError – If the case ID does not exist in the event log.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_case_sequence(event_log,19)) Event log loaded and formated from file: files/examples.csv ['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor']
- langgraph_compare.analyze_case_id.get_case_sequence_prob(event_log: DataFrame, case_id: int) tuple[list[str], float] [source]
Return the activity sequence with its probability for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve the sequence and probability for.
- Returns:
A tuple containing (sequence, probability) for the specified case ID.
- Return type:
tuple
- Raises:
ValueError – If the case ID does not exist in the event log.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_case_sequence_prob(event_log,19)) Event log loaded and formated from file: files/examples.csv (['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor'], 0.3333333333333333)
- langgraph_compare.analyze_case_id.get_case_start(event_log: DataFrame, case_id: int) str [source]
Retrieve the first activity for the specified case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve the start activity for.
- Returns:
The first activity in the sequence.
- Return type:
str
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_case_start(event_log,19)) Event log loaded and formated from file: files/examples.csv __start__
- langgraph_compare.analyze_case_id.get_case_sum_act_times(event_log: DataFrame, case_id: int) dict[str, float] [source]
Calculate the sum service time in seconds for each activity for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID for which to calculate service times.
- Returns:
Sum service times for each activity in the specified case.
- Return type:
dict
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print(get_case_sum_act_times(event_log,19)) Event log loaded and formated from file: files/examples.csv {'ChartGenerator': 0.608224, 'DocWriter': 2.0285469999999997, 'Search': 1.7249849999999998, 'WebScraper': 2.4464859999999997, '__start__': 0.603216, 'ag_supervisor': 0.10220199999999999, 'rg_supervisor': 23.0226, 'test_supervisor': 0.747701}
- langgraph_compare.analyze_case_id.print_case_act_counts(event_log: DataFrame, case_id: int) None [source]
Print the count of each activity for the specified case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to count and print activities for.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_case_act_counts(event_log,19) Event log loaded and formated from file: files/examples.csv Count of each activity for case ID 19: Activity '__start__': 18 Activity 'test_supervisor': 18 Activity 'rg_supervisor': 15 Activity 'Search': 3 Activity 'WebScraper': 4 Activity 'ag_supervisor': 14 Activity 'ChartGenerator': 1 Activity 'DocWriter': 4
- langgraph_compare.analyze_case_id.print_case_act_reworks(event_log: DataFrame, case_id: int) None [source]
Print the rework counts for each activity for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve and print the rework counts for.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_case_act_reworks(event_log,19) Event log loaded and formated from file: files/examples.csv Rework counts for case ID 19: {'__start__': 18, 'test_supervisor': 18, 'rg_supervisor': 15, 'Search': 3, 'WebScraper': 4, 'ag_supervisor': 14, 'DocWriter': 4}
- langgraph_compare.analyze_case_id.print_case_analysis(event_log: DataFrame, case_id: int) None [source]
Run multiple analyses on single case_id and print the results.
- Parameters:
event_log (pd.DataFrame) – The event log data to analyze.
case_id (int) – The case ID to retrieve and analyze.
Example:
csv_output = "files/examples.csv" event_log = load_event_log(csv_output) print_full_analysis_by_id(event_log,19) # Event log loaded and formated from file: files/examples.csv # # #########################START######################### # # Start activity for case ID 1: __start__ # # End activity for case ID 1: test_supervisor # # Count of each activity for case ID 1: # Activity '__start__': 4 # Activity 'test_supervisor': 4 # Activity 'rg_supervisor': 4 # Activity 'Search': 1 # Activity 'WebScraper': 1 # Activity 'ag_supervisor': 4 # Activity 'DocWriter': 1 # Activity 'NoteTaker': 1 # Activity 'ChartGenerator': 1 # # Activity sequence for case ID 1: ['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'NoteTaker', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor'] # Probability: 0.333 # # Minimum self distances for case ID 1: {'__start__': 1, 'ag_supervisor': 1, 'rg_supervisor': 1, 'test_supervisor': 2} # # Minimum self distance witnesses for case ID 1: {'__start__': [['test_supervisor']], 'test_supervisor': [['__start__', 'rg_supervisor']], 'rg_supervisor': [['WebScraper'], ['Search']], 'ag_supervisor': [['NoteTaker'], ['DocWriter'], ['ChartGenerator']]} # # Rework counts for case ID 1: {'__start__': 4, 'test_supervisor': 4, 'rg_supervisor': 4, 'ag_supervisor': 4} # # Sum service time of each activity for case ID 1: # Activity 'ChartGenerator': 0.567 s # Activity 'DocWriter': 0.712 s # Activity 'NoteTaker': 0.616 s # Activity 'Search': 0.502 s # Activity 'WebScraper': 0.506 s # Activity '__start__': 3.137 s # Activity 'ag_supervisor': 0.018 s # Activity 'rg_supervisor': 3.446 s # Activity 'test_supervisor': 0.013 s # # Duration for case ID 1: 43.88 s # # #########################END#########################
- langgraph_compare.analyze_case_id.print_case_duration(event_log: DataFrame, case_id: int) None [source]
Print the duration time for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve and print the duration time for.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_case_duration(event_log,19) Event log loaded and formated from file: files/examples.csv Duration for case ID 19: 120.731 s
- langgraph_compare.analyze_case_id.print_case_end(event_log: DataFrame, case_id: int) None [source]
Print the last activity for the specified case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve and print the end activity for.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_case_end(event_log,19) Event log loaded and formated from file: files/examples.csv End activity for case ID 19: test_supervisor
- langgraph_compare.analyze_case_id.print_case_min_self_dists(event_log: DataFrame, case_id: int) None [source]
Print the minimum self-distances for all activities for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve and print the minimum self-distances for.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_case_min_self_dists(event_log,19) Event log loaded and formated from file: files/examples.csv Minimum self distances for case ID 19: {'DocWriter': 1, 'Search': 6, 'WebScraper': 4, '__start__': 1, 'ag_supervisor': 1, 'rg_supervisor': 1, 'test_supervisor': 2}
- langgraph_compare.analyze_case_id.print_case_self_dist_witnesses(event_log: DataFrame, case_id: int) None [source]
Print the minimum self-distance witnesses for all activities for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve and print the witnesses for.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_case_self_dist_witnesses(event_log,19) Event log loaded and formated from file: files/examples.csv Minimum self distance witnesses for case ID 19: {'__start__': [['test_supervisor']], 'test_supervisor': [['__start__', 'ag_supervisor'], ['__start__', 'rg_supervisor']], 'rg_supervisor': [['Search'], ['WebScraper']], 'Search': [['rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor']], 'WebScraper': [['rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor']], 'ag_supervisor': [['DocWriter'], ['ChartGenerator']], 'DocWriter': [['ag_supervisor']]}
- langgraph_compare.analyze_case_id.print_case_sequence(event_log: DataFrame, case_id: int) None [source]
Print the activity sequence for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve the sequence for.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_case_sequence(event_log,19) Event log loaded and formated from file: files/examples.csv Activity sequence for case ID 19: ['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor']
- langgraph_compare.analyze_case_id.print_case_sequence_prob(event_log: DataFrame, case_id: int) None [source]
Print the activity sequence with its probability for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve and print the sequence and probability for.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_case_sequence_prob(event_log,19) Event log loaded and formated from file: files/examples.csv Activity sequence for case ID 19: ['__start__', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'ChartGenerator', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'Search', 'rg_supervisor', 'WebScraper', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'DocWriter', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'ag_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor', '__start__', 'rg_supervisor', 'test_supervisor'] Probability: 0.333
- langgraph_compare.analyze_case_id.print_case_start(event_log: DataFrame, case_id: int) None [source]
Print the first activity for the specified case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID to retrieve and print the start activity for.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_case_start(event_log,19) Event log loaded and formated from file: files/examples.csv Start activity for case ID 19: __start__
- langgraph_compare.analyze_case_id.print_case_sum_act_times(event_log: DataFrame, case_id: int) None [source]
Print the sum service time in seconds for each activity for a specific case ID.
- Parameters:
event_log (pd.DataFrame) – Event log data.
case_id (int) – The case ID for which to calculate service times.
Example:
>>> csv_output = "files/examples.csv" >>> event_log = load_event_log(csv_output) >>> print_sum_service_time_by_case_id(event_log,19) Event log loaded and formated from file: files/examples.csv Sum service time of each activity for case ID 19: Activity 'ChartGenerator': 0.608 s Activity 'DocWriter': 2.0285 s Activity 'Search': 1.725 s Activity 'WebScraper': 2.446 s Activity '__start__': 0.603 s Activity 'ag_supervisor': 0.102 s Activity 'rg_supervisor': 23.023 s Activity 'test_supervisor': 0.748 s
langgraph_compare.artifacts
- langgraph_compare.artifacts.generate_artifacts(event_log: DataFrame, graph: CompiledStateGraph, output: ExperimentPaths | str) None [source]
Generate all analysis artifacts including reports and visualizations. Executes generate_reports followed by generate_visualizations.
- Parameters:
event_log (pd.DataFrame) – Event log data containing process execution information
graph (CompiledStateGraph) – Compiled state graph for visualization generation
output (Union[ExperimentPaths, str]) – ExperimentPaths instance or path to save the analysis outputs
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> generate_artifacts(event_log,graph,exp) Metrics report successfully generated at: experiments/my_experiment/reports/metrics_report.json Sequences report successfully generated at: experiments/my_experiment/reports/sequences_report.json All reports successfully generated. Generating all visualizations... Mermaid saved as: experiments/my_experiment/img/mermaid.png Prefix Tree saved as: experiments/my_experiment/img/prefix_tree.png Performance DFG saved as: experiments/my_experiment/img/dfg_performance.png All visualizations generated successfully! Analysis generation completed successfully!
>>> # Using direct path: >>> generate_artifacts(event_log,graph,"analysis_output") Metrics report successfully generated at: analysis_output/reports/metrics_report.json Sequences report successfully generated at: analysis_output/reports/sequences_report.json All reports successfully generated. Generating all visualizations... Mermaid saved as: analysis_output/img/mermaid.png Prefix Tree saved as: analysis_output/img/prefix_tree.png Performance DFG saved as: analysis_output/img/dfg_performance.png All visualizations generated successfully! Analysis generation completed successfully!
- langgraph_compare.artifacts.prepare_data(source: ExperimentPaths | str, graph_config: GraphConfig, output_folder: str | None = None, output_csv_dir: str | None = None) None [source]
Complete pipeline to export data from SQLite to CSV via JSON intermediary. Executes export_sqlite_to_jsons followed by export_jsons_to_csv.
- Parameters:
source (Union[ExperimentPaths, str]) – Either an ExperimentPaths instance or a path to the SQLite database
graph_config (GraphConfig) – The graph configuration object for CSV export
output_folder (Optional[str]) – Path to the output folder for JSON files (required if source is a str)
output_csv_dir (Optional[str]) – Directory where csv_output.csv will be saved (required if source is a str)
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> graph_config = GraphConfig(nodes=["chatbot_node"]) >>> export_sqlite_to_csv(exp, graph_config) JSON file created: experiments/my_experiment/json/thread_1.json JSON file created: experiments/my_experiment/json/thread_2.json Processed: experiments/my_experiment/json/thread_1.json Processed: experiments/my_experiment/json/thread_2.json Successfully exported combined data to: experiments/my_experiment/csv/csv_output.csv
>>> # Using direct paths: >>> export_sqlite_to_csv( ... "path/to/db.sqlite", ... graph_config, ... output_folder="path/to/json_output", ... csv_path="path/to/output.csv" ... ) JSON file created: path/to/json_output/thread_1.json JSON file created: path/to/json_output/thread_2.json Processed: path/to/json_output/thread_1.json Processed: path/to/json_output/thread_2.json Successfully exported combined data to: path/to/output.csv
langgraph_compare.create_html
- class langgraph_compare.create_html.InfrastructureDirs(reports_dir: str, images_dir: str | None = None)[source]
Bases:
object
Class to hold directory paths for infrastructure data.
- classmethod from_default_structure(base_path: str) InfrastructureDirs [source]
Create paths using default directory structure.
- images_dir: str | None = None
- reports_dir: str
- langgraph_compare.create_html.compare(infrastructures: List[str] | Dict[str, str | InfrastructureDirs], base_dir: str | None = None, output_dir: str | None = None) None [source]
Generate and open HTML comparison report comparing multi-agent infrastructures.
- Parameters:
infrastructures (Union[List[str], Dict[str, Union[str, InfrastructureDirs]]]) – List of infrastructure names or dictionary mapping names to paths. Can be: - List of infrastructure names for default structure - Dict mapping names to directory paths or InfrastructureDirs objects
base_dir (Optional[str]) – Base directory where all experiments are stored, defaults to “experiments”
output_dir (Optional[str]) – Directory where generated reports will be saved, defaults to “comparison_reports”
Examples:
Basic usage with default directory structure:
compare(["test_1", "test_2"])
Using custom paths with default subdirectory structure:
# Will use path/to/test1/reports/ and path/to/test1/img/ compare({ "test_1": "path/to/test1", "test_2": "path/to/test2" })
Using fully custom directory paths:
compare({ "test_1": InfrastructureDirs( reports_dir="custom/path1/my_reports", images_dir="custom/path1/my_images" ), "test_2": InfrastructureDirs( reports_dir="custom/path2/my_reports" ) })
Save to specific output directory:
compare(infrastructures, output_dir="my_reports")
langgraph_compare.create_report
- langgraph_compare.create_report.generate_reports(event_log: DataFrame, output_dir: ExperimentPaths | str) None [source]
Generate and save all analysis reports in JSON format.
- The generated JSON reports include:
Count of activities
Rework counts per activity
Mean service times per activity
Average graph duration
Start activities
End activities
Last occurrence of the sequences with probabilities
- Parameters:
event_log (pd.DataFrame) – Event log data containing process execution information
output_dir (Union[ExperimentPaths, str]) – ExperimentPaths instance or directory path where the reports will be saved
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> generate_reports(event_log, exp) Metrics report successfully generated at: experiments/my_experiment/reports/metrics_report.json Sequences report successfully generated at: experiments/my_experiment/reports/sequences_report.json All reports successfully generated.
>>> # Using direct path: >>> generate_reports(event_log, "analysis") Metrics report successfully generated at: analysis/metrics_report.json Sequences report successfully generated at: analysis/sequences_report.json All reports successfully generated.
- langgraph_compare.create_report.write_metrics_report(event_log: DataFrame, output_dir: ExperimentPaths | str) None [source]
Generate and save a comprehensive analysis report of the entire event log in JSON format.
- The generated JSON report includes:
Count of activities
Rework counts per activity
Mean service times per activity
Average graph duration
- Parameters:
event_log (pd.DataFrame) – Event log data containing process execution information
output_dir (Union[ExperimentPaths, str]) – ExperimentPaths instance or directory path where the report will be saved
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> write_metrics_report(event_log, exp) Metrics report successfully generated at: experiments/my_experiment/reports/metrics_report.json
>>> # Using direct path: >>> write_metrics_report(event_log, "analysis") Metrics report successfully generated at: analysis/metrics_report.json
- langgraph_compare.create_report.write_sequences_report(event_log: DataFrame, output_dir: ExperimentPaths | str) None [source]
Generate and save a comprehensive sequences report in JSON format.
- The generated JSON report includes:
Start activities
End activities
Last occurrence of the sequences with probabilities
- Parameters:
event_log (pd.DataFrame) – Event log data containing process execution information
output_dir (Union[ExperimentPaths, str]) – ExperimentPaths instance or directory path where the report will be saved
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> write_sequences_report(event_log, exp) Sequences report successfully generated at: experiments/my_experiment/reports/sequences_report.json
>>> # Using direct path: >>> write_sequences_report(event_log, "analysis") Sequences report successfully generated at: analysis/sequences_report.json
langgraph_compare.experiment
- class langgraph_compare.experiment.ExperimentPaths(name: str, base_dir: str = 'experiments', _connection: Connection | None = None, _memory: SqliteSaver | None = None)[source]
Bases:
object
Class that holds and manages all paths for an experiment.
- Parameters:
name (str) – Name of the experiment that will be used for folder structure.
base_dir (str) – Base directory where all experiments are stored, defaults to “experiments”.
- base_dir: str = 'experiments'
- property connection: Connection
Returns or creates SQLite connection with appropriate settings.
- Returns:
SQLite connection object
- Return type:
sqlite3.Connection
Example:
>>> paths = ExperimentPaths("test") >>> conn = paths.connection # Creates new connection if none exists >>> conn2 = paths.connection # Returns existing connection
- property csv_dir: str
Returns path to the csv directory.
- Returns:
Full path to the CSV directory.
- Return type:
str
Example:
>>> paths = ExperimentPaths("test") >>> paths.csv_dir 'experiments/test/csv'
- property database: str
Returns path to the main SQLite database.
- Returns:
Full path to the SQLite database file.
- Return type:
str
Example:
>>> paths = ExperimentPaths("test") >>> paths.database 'experiments/test/db/test.sqlite'
- get_csv_path(filename: str = 'csv_output.csv') str [source]
Returns full path for a CSV file.
- Parameters:
filename (str) – Name of the CSV file.
- Returns:
Full path to the CSV file.
- Return type:
str
Example:
>>> paths = ExperimentPaths("test") >>> paths.get_csv_path("data.csv") 'experiments/test/csv/data.csv'
- get_img_path(filename: str | None = None) str [source]
Returns full path for an image file.
- Parameters:
filename (Optional[str]) – Name of the image file, if None uses the default from the calling function
- Returns:
Full path to the image file.
- Return type:
str
Example:
>>> paths = ExperimentPaths("test") >>> paths.get_img_path("plot.png") 'experiments/test/img/plot.png' >>> # When used in functions, will use that function's default >>> generate_prefix_tree(event_log, paths.get_img_path()) # Will use 'tree.png' >>> generate_dfg(event_log, paths.get_img_path()) # Will use 'dfg.png'
- property img_dir: str
Returns path to the img directory.
- Returns:
Full path to the images directory.
- Return type:
str
Example:
>>> paths = ExperimentPaths("test") >>> paths.img_dir 'experiments/test/img'
- property json_dir: str
Returns path to the json directory.
- Returns:
Full path to the JSON directory.
- Return type:
str
Example:
>>> paths = ExperimentPaths("test") >>> paths.json_dir 'experiments/test/json'
- property memory: SqliteSaver
Returns or creates SqliteSaver instance for the database.
- Returns:
SqliteSaver instance
- Return type:
SqliteSaver
Example:
>>> paths = ExperimentPaths("test") >>> saver = paths.memory # Creates new SqliteSaver if none exists >>> saver2 = paths.memory # Returns existing SqliteSaver
- name: str
- property reports_dir: str
Returns path to the reports directory.
- Returns:
Full path to the reports directory.
- Return type:
str
Example:
>>> paths = ExperimentPaths("test") >>> paths.reports_dir 'experiments/test/reports'
- langgraph_compare.experiment.create_experiment(name: str, base_dir: str = 'experiments') ExperimentPaths [source]
Main function to set up experiment and return paths. This is the main entry point for creating a new experiment structure.
- Parameters:
name (str) – Name of the experiment to be created.
base_dir (str) – Base directory where the experiment folder will be created, defaults to “experiments”.
- Returns:
ExperimentPaths object containing all relevant paths.
- Return type:
Example:
>>> paths = create_experiment("my_experiment", base_dir="custom_experiments") Creating new experiment... Successfully created 'custom_experiments/my_experiment' with subfolders: db, img, json, csv, reports Experiment 'my_experiment' created successfully! Database path: custom_experiments/my_experiment/db/my_experiment.sqlite JSON directory: custom_experiments/my_experiment/json CSV directory: custom_experiments/my_experiment/csv Image directory: custom_experiments/my_experiment/img Reports directory: custom_experiments/my_experiment/reports
langgraph_compare.graph_runner
- langgraph_compare.graph_runner.run_multiple_iterations(graph: CompiledStateGraph, starting_thread_id: int, num_repetitions: int, user_input_template: Dict[str, Any], recursion_limit: int = 100) None [source]
Run the provided graph num_repetitions times, incrementing the thread_id each time. Tracks and displays step iterations within each graph run.
- Parameters:
graph (CompiledStateGraph) – The compiled StateGraph to run.
starting_thread_id (int) – The starting thread_id for the graph.
num_repetitions (int) – Number of times to run the graph.
user_input_template (Dict[str, Any]) – The template for user input, which may vary by iteration.
recursion_limit (int) – Maximum recursion depth allowed for each graph run.
Example:
# .compile method from official langgraph package graph = graph_builder.compile(checkpointer=memory) # Run the graph for 2 iterations, starting from thread ID 1 run_multiple_iterations(graph, 1, 2, {"messages": [("user", "Tell me a joke")]}) # Output: # Iteration: 1, Thread_ID 1 # Step 0: # {'messages': [AIMessage(content='Climate change is a significant global challenge...', # additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 18, # 'prompt_tokens': 11, 'total_tokens': 29}})]} # --- # Iteration: 2, Thread_ID 2 # Step 0: # {'messages': [AIMessage(content='The climate crisis requires immediate action...', # additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 17, # 'prompt_tokens': 11, 'total_tokens': 28}})]} # ---
langgraph_compare.jsons_to_csv
- class langgraph_compare.jsons_to_csv.GraphConfig(supervisors: List[SupervisorConfig] | None = None, subgraphs: List[SubgraphConfig] | None = None, nodes: List[str] | None = None)[source]
Bases:
object
Overall graph configuration.
- Parameters:
supervisors (Optional[List[SupervisorConfig]]) – Optional list of graph-level supervisors.
subgraphs (Optional[List[SubgraphConfig]]) – Optional list of subgraphs.
nodes (Optional[List[str]]) – Optional list of nodes for non-subgraph mode.
- nodes: List[str] | None = None
- subgraphs: List[SubgraphConfig] | None = None
- supervisors: List[SupervisorConfig] | None = None
- class langgraph_compare.jsons_to_csv.SubgraphConfig(name: str, nodes: List[str], supervisor: SupervisorConfig)[source]
Bases:
object
Configuration for a subgraph and its components.
- Parameters:
name (str) – Name of the subgraph.
nodes (List[str]) – List of nodes within the subgraph.
supervisor (SupervisorConfig) – Configuration of the subgraph’s supervisor.
- name: str
- nodes: List[str]
- supervisor: SupervisorConfig
- class langgraph_compare.jsons_to_csv.SupervisorConfig(name: str, supervisor_type: str)[source]
Bases:
object
Configuration for a supervisor node.
- Parameters:
name (str) – Name of the supervisor.
supervisor_type (str) – Type of the supervisor (‘graph’ or ‘subgraph’).
- name: str
- supervisor_type: str
- langgraph_compare.jsons_to_csv.export_jsons_to_csv(source: ExperimentPaths | str, graph_config: GraphConfig, output_dir: str | None = None) None [source]
Process all JSON files and export them to csv_output.csv in the specified directory. Can use either an ExperimentPaths instance or explicit paths.
- Parameters:
source (Union[ExperimentPaths, str]) – Either an ExperimentPaths instance or a path to the JSON directory
graph_config (GraphConfig) – The graph configuration object
output_dir (Optional[str]) – Directory where csv_output.csv will be saved (required if source is a str)
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> graph_config = GraphConfig(nodes=["chatbot_node"]) >>> export_jsons_to_csv(exp, graph_config) Processed: experiments/my_experiment/json/thread_1.json Processed: experiments/my_experiment/json/thread_2.json Processed: experiments/my_experiment/json/thread_3.json Successfully exported combined data to: experiments/my_experiment/csv/csv_output.csv
>>> # Using direct paths: >>> export_jsons_to_csv("path/to/jsons", graph_config, "path/to/output_directory") Processed: path/to/jsons/thread_1.json Processed: path/to/jsons/thread_2.json Processed: path/to/jsons/thread_3.json Successfully exported combined data to: path/to/output_directory/csv_output.csv
langgraph_compare.load_events
- langgraph_compare.load_events.load_event_log(source: ExperimentPaths | str) DataFrame [source]
Load CSV data into a formatted PM4Py DataFrame. Can load either from an ExperimentPaths instance or directly from a file path.
- Parameters:
source (Union[ExperimentPaths, str]) – Either an ExperimentPaths instance or a direct file path
- Returns:
PM4Py formatted DataFrame
- Return type:
pd.DataFrame
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> event_log = load_event_log(exp) Event log loaded and formatted from file: experiments/my_experiment/csv/csv_output.csv
>>> # Using direct file path: >>> event_log = load_event_log("files/examples.csv") Event log loaded and formatted from file: files/examples.csv
langgraph_compare.sql_to_jsons
- langgraph_compare.sql_to_jsons.export_sqlite_to_jsons(source: ExperimentPaths | str, output_folder: str | None = None) None [source]
Fetch data from the SQLite database and export it as JSON files. Can use either an ExperimentPaths instance or explicit database and output paths.
- Parameters:
source (Union[ExperimentPaths, str]) – Either an ExperimentPaths instance or a path to the SQLite database
output_folder (Optional[str]) – Path to the output folder for JSON files (required if source is a str)
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> export_sqlite_to_jsons(exp) JSON file created: experiments/my_experiment/json/thread_1.json JSON file created: experiments/my_experiment/json/thread_2.json JSON file created: experiments/my_experiment/json/thread_3.json
>>> # Using direct paths: >>> export_sqlite_to_jsons("path/to/db.sqlite", "path/to/output") JSON file created: path/to/output/thread_1.json JSON file created: path/to/output/thread_2.json JSON file created: path/to/output/thread_3.json
langgraph_compare.visualize
- langgraph_compare.visualize.generate_mermaid(graph: CompiledStateGraph, output_dir: ExperimentPaths | str) None [source]
Generate and save a mermaid graph visualization.
- Parameters:
graph (CompiledStateGraph) – Compiled state graph
output_dir (Union[ExperimentPaths, str]) – ExperimentPaths instance or directory path where visualization will be saved
- Raises:
FileNotFoundError – If the output directory does not exist
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> generate_mermaid(graph, exp) Mermaid saved as: experiments/my_experiment/img/mermaid.png
>>> # Using direct path: >>> generate_mermaid(graph, "output/visualizations") # Directory must exist Mermaid saved as: output/visualizations/mermaid.png
- langgraph_compare.visualize.generate_performance_dfg(event_log: DataFrame, output_dir: ExperimentPaths | str) None [source]
Generate and save a visualization of directly-follows graph annotated with performance.
- Parameters:
event_log (pd.DataFrame) – Event log data
output_dir (Union[ExperimentPaths, str]) – ExperimentPaths instance or directory path where visualization will be saved
- Raises:
FileNotFoundError – If the output directory does not exist
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> generate_performance_dfg(event_log, exp) Performance DFG saved as: experiments/my_experiment/img/dfg_performance.png
>>> # Using direct path: >>> generate_performance_dfg(event_log, "output/visualizations") # Directory must exist Performance DFG saved as: output/visualizations/dfg_performance.png
- langgraph_compare.visualize.generate_prefix_tree(event_log: DataFrame, output_dir: ExperimentPaths | str) None [source]
Generate and save a prefix tree visualization.
- Parameters:
event_log (pd.DataFrame) – Event log data
output_dir (Union[ExperimentPaths, str]) – ExperimentPaths instance or directory path where visualization will be saved
- Raises:
FileNotFoundError – If the output directory does not exist
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> generate_prefix_tree(event_log, exp) Prefix Tree saved as: experiments/my_experiment/img/prefix_tree.png
>>> # Using direct path: >>> generate_prefix_tree(event_log, "output/visualizations") # Directory must exist Prefix Tree saved as: output/visualizations/prefix_tree.png
- langgraph_compare.visualize.generate_visualizations(event_log: DataFrame, graph: CompiledStateGraph, output_dir: ExperimentPaths | str) None [source]
Generate and save all process visualizations.
- Parameters:
event_log (pd.DataFrame) – Event log data
graph (CompiledStateGraph) – Compiled state graph
output_dir (Union[ExperimentPaths, str]) – ExperimentPaths instance or directory path where visualizations will be saved
- Raises:
FileNotFoundError – If the output directory does not exist
Examples:
>>> # Using ExperimentPaths: >>> exp = create_experiment("my_experiment") >>> generate_visualizations(event_log, graph, exp) Generating all visualizations... Mermaid saved as: experiments/my_experiment/img/mermaid.png Prefix Tree saved as: experiments/my_experiment/img/prefix_tree.png Performance DFG saved as: experiments/my_experiment/img/dfg_performance.png All visualizations generated successfully!
>>> # Using direct path: >>> generate_visualizations(event_log, graph, "output/visualizations") # Directory must exist Generating all visualizations... Mermaid saved as: output/visualizations/mermaid.png Prefix Tree saved as: output/visualizations/prefix_tree.png Performance DFG saved as: output/visualizations/dfg_performance.png All visualizations generated successfully!