The studies on hyperspectral target detection until now, has been treated in two approaches. Anomaly detection can be considered as the first approach, which analyses the hyperspectral image with respect to the difference between target and the rest of the hyperspectral image. The second approach compares the previously obtained spectral signature of the target with the pixels of the hyperspectral image in order to localize the target. A distinctive disadvantage of the aforementioned approaches is to treat each pixel of the hyperspectral image individually, without considering the neighbourhood relations between the pixels. In this paper, we propose a target detection algorithm which combines the anomaly detection and signature based hyperspectral target detection approaches in a graph based framework by utilizing the neighbourhood relations between the pixels. Assuming that the target signature is available and the target sizes are in the range of anomaly sizes, a novel derivative based matched filter is first proposed to model the foreground. Second, a new anomaly detection method which models the background as a Gaussian mixture is developed. The developed model estimates the optimal number of components forming the Gaussian mixture by means of utilizing sparsity information. Finally, the similarity of the neighbouring hyperspectral pixels is measured with the spectral angle mapper. The overall proposed graph based method has successfully combined the foreground, background and neighbouring information and improved the detection performance by locating the target as a whole object free from noises.