#### All Paths From Source To Target

m
```/**
* Author : Siddhant Swarup Mallick
* Github : https://github.com/siddhant2002
*/

/** Program description - To find all possible paths from source to destination*/

package com.thealgorithms.backtracking;

import java.util.*;

public class AllPathsFromSourceToTarget {

// No. of vertices in graph
private final int v;

// To store the paths from source to destination
static List<List<Integer>> nm = new ArrayList<>();

// Constructor
public AllPathsFromSourceToTarget(int vertices) {

// initialise vertex count
this.v = vertices;

}

// utility method to initialise adjacency list

for (int i = 0; i < v; i++) {
}
}

// add edge from u to v
public void addEdge(int u, int v) {
// Add v to u's list.
}

public void storeAllPaths(int s, int d) {
boolean[] isVisited = new boolean[v];
ArrayList<Integer> pathList = new ArrayList<>();

// Call recursive utility
storeAllPathsUtil(s, d, isVisited, pathList);
}

// A recursive function to print all paths from 'u' to 'd'.
// isVisited[] keeps track of vertices in current path.
// localPathList<> stores actual vertices in the current path
private void storeAllPathsUtil(Integer u, Integer d, boolean[] isVisited, List<Integer> localPathList) {

if (u.equals(d)) {
return;
}

// Mark the current node
isVisited[u] = true;

// Recursion for all the vertices adjacent to current vertex

for (Integer i : adjList[u]) {
if (!isVisited[i]) {
// store current node in path[]
storeAllPathsUtil(i, d, isVisited, localPathList);

// remove current node in path[]
localPathList.remove(i);
}
}

// Mark the current node
isVisited[u] = false;
}

// Driver program
public static List<List<Integer>> allPathsFromSourceToTarget(int vertices, int[][] a, int source, int destination) {
// Create a sample graph
AllPathsFromSourceToTarget g = new AllPathsFromSourceToTarget(vertices);
for (int[] i : a) {